How to invoke AppOps in Android 4.4 KITKAT

In Android 4.3, we were able to invoke AppOps activity, a hidden brand-new security functionality. However the activity was completely hidden in Android 4.3.1 and later.

Can we never invoke AppOps in Android KITKAT?

Yes, there is a way to invoke AppOps not only in Android 4.3 but also 4.4.

UPDATE(Dec 10, 2013): Unfortunately, we cannot invoke AppOps setting fragment in Android 4.4.2.

If you activated developer mode in your KITKAT device, connect your device to PC and then try the following command.

% adb shell am start -n com.android.settings/com.android.settings.Settings \
-e :android:show_fragment com.android.settings.applications.AppOpsSummary \
--activity-clear-task --activity-exclude-from-recents

The new way invokes AppOps fragment via the Setting app!!

Of course, you can invoke AppOps from your application.

Intent intent = new Intent();
intent.setClassName("com.android.settings",
        "com.android.settings.Settings");
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
        Intent.FLAG_ACTIVITY_CLEAR_TASK |
        Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
intent.putExtra(":android:show_fragment",
        "com.android.settings.applications.AppOpsSummary");
startActivity(intent);

I confirmed that works fine both in Android 4.3 and 4.4.

The original method was discovered by @adakoda. Great job!!

I only fix some issues. For instance, @adakoda’s method didn’t work when the Setting app is on recent apps.

Reference: