[GUIDE] Enable App Ops (Application Permissions)

原文:http://forum.xda-developers.com/verizon-galaxy-s6/general/guide-enable-app-ops-application-t3176638

 

 

While looking around at the decompiled SecSettings2.apk, I noticed that all of the App Ops (application permissions) stuff was still present. So, I decided to look for a way to enable the Settings menu option for Application Permissions.

The xml files all seemed to have the entries required to display the option, but the smali code was preventing it.

Note that there are apps in the store that will give you this feature, but this method doesn’t require an additional app and it uses the built-in settings menus.

I have not tested every permission, but I did disabled “location” for several apps and that worked perfectly.

This is an easy mod if you know how to decompile/recompile.

There are 2 ways to implement the Application Permissions menu option:

Method 1 (requires deodexed app and smali edit)

  1. Decompile the deodexed SecSettings2.apk.
  2. In the smali folder, navigate to comandroidsettingsLockscreenMenuSettings.smali
  3. Do a search for the following line:
    Code:
    iget-object v14, v0, Lcom/android/settings/LockscreenMenuSettings;->mAppOpsSettings:Landroid/preference/Preference;
  4. Just after the first instance of that code, you will see:
    Code:
    if-eqz v14, :cond_d
  5. Change it to:
    Code:
    if-nez v14, :cond_d
  6. Save and recompile.
  7. You will find the “Application Permissions” menu under the “Lock screen and Security” settings menu (screenshot #1).


Method 2 (easier – can be either odexed or deodexed)

  1. Decompile SecSettings2.apk
  2. Open the res/xml/applications_settings_vzw.xml
  3. Insert the following code on a line right above “PreferenceCategory” near the bottom:
    Code:
    <PreferenceScreen android:icon="@drawable/st_application_ic_application_permission" android:title="@string/app_ops_settings" android:key="app_ops_settings" android:fragment="com.android.settings.applications.AppOpsSummary" />
  4. Save and recompile.
  5. You will find the “Application Permissions” menu under the “Applications” settings menu. (screenshot #2)

Disclaimer: This is intended mainly for rom devs to use, but if you like making your own mods, then feel free to give it a try. I take no responsibility for any modifications you make to your device. Always ensure that you have the required files to restore if something goes wrong.