Runtime Permission

Discussion in 'Android' started by NST_Adventure, Jun 5, 2021.

  1. NST_Adventure

    NST_Adventure MDL Addicted

    Jun 1, 2019
    885
    182
    30
    #1 NST_Adventure, Jun 5, 2021
    Last edited: Sep 8, 2021
    Runtime Permission

    Is A PROCESS where App Will Request Permission (On Your Consents) When You Run App For First Time
    (Or When App Just Installed)
    By Default You Only Have 3 Available Option On Runtime Process:
    1. Allow
    2. Allow Only In Foreground
    3. Deny


    What If Permission Is unnecessary?
    Well blatantly Deny is not Option
    App Can Instantly Crash If Some Runtime Permission Are Denied


    The Only Solution Is:
    Access Permission Using App Ops
    (App Operation)

    App Ops Have Following Options:
    -Allow
    -Allow In Foreground
    -Ignore
    -Deny
    -Default


    You May Use Following Command To IGNORE Permission:
    cmd appops set <App package name> <App Ops> <Mode Or Flag>

    example:
    cmd appops set <com.android.googlechrome> <RUN_IN_BACKGROUND> <Ignore>



    how ignore work?
    when apps permission ignored app target will read them as allowed but when app request for that operation they will get nothing or operation will not performed

    (Runtime)Permission:
    1. You Cannot Ignore Permission They Only Have Option To Allow Or Allow In Foreground And Deny

    2. App Can Request Again And Again (But Fortunately You Can Choose To Don't Ask Again After Denied)

    3. Not All Permission Have Same Option Example If You Want To Allow Permission In Background You Can Only Apply Them For LOCATION Permission


    App Ops:
    1. You Can Ignore Permission
    2. No Repeated Request
    3. You Will Get Detailed And Hidden Permission That You Normally Can't Access

    4. All Permission Have Same Options

    Detailed Normal Permission Example:
    Get Location:
    Access Loaction in Foreground (COARSE_LOCATION)

    Access Location In Background
    (ACCESS_BACKGROUND_LOCATION)

    Monitor High Power Location
    (MONITOR_HIGH_POWER_LOCATION)


    Hidden Permission Example:
    Allow App To Prevent Devices Sleep
    (WAKE_LOCK)


    With App Ops You Can Change Hidden Permission Can Change Permission Individually

    If Permission Changed Via App Ops (Deny)
    You Only Able To Change It Via App Ops Again
    Allow Button On Setting Will Do Absolutely Nothing

    Run time permission and app ops are independent
    app ops result will determine after runtime permission

    example if you grant or allow access via runtime permission dialog but app ops choose deny then final result will denied

    ⚠️issues⚠️
    1. App ops constantly got reset by system
    Since Android Q
    app ops can get reset or even worse you can't change them is due to limitations

    and we only found 2 solutions:
    1. Create auto recovery services
    This service is used to revert app ops change to your previous setting everytime system reset this back to default the only disadvantage of this that app ops manager app must run in foreground and background also need display push notifications services

    (read more on android Q Rules Spoiler)

    2. Using root privilege to run app ops
    Well for rooted user just start app ops framework right away via su shell or root privilege it shouldn't take long and has no disadvantage

    (except for rooting itself is dangerous especially for newbie)

    Since Android Q app that run in background should show push notifications services or connect them to GCM
    (Bruh the F? GCM is immune to killing system here)

    To make sure it work first you need exclude app from battery saving feature such as aggressive memory killing and allow permission to run in background

    (Well enable auto start is good option also Yes, even though in the end the battery runs out rather quickly)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...