Search in sources :

Example 1 with AppOpEntry

use of com.android.settings.applications.AppOpsState.AppOpEntry in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AppOpsCategory method onListItemClick.

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    AppOpEntry entry = mAdapter.getItem(position);
    if (entry != null) {
        if (mUserControlled) {
            // We treat this as tapping on the check box, toggling the app op state.
            Switch sw = ((Switch) v.findViewById(R.id.op_switch));
            boolean checked = !sw.isChecked();
            sw.setChecked(checked);
            AppOpsManager.OpEntry op = entry.getOpEntry(0);
            int mode = checked ? AppOpsManager.MODE_ALLOWED : AppOpsManager.MODE_IGNORED;
            mState.getAppOpsManager().setMode(op.getOp(), entry.getAppEntry().getApplicationInfo().uid, entry.getAppEntry().getApplicationInfo().packageName, mode);
            entry.overridePrimaryOpMode(mode);
        } else {
            mCurrentPkgName = entry.getAppEntry().getApplicationInfo().packageName;
            startApplicationDetailsActivity();
        }
    }
}
Also used : AppOpsManager(android.app.AppOpsManager) Switch(android.widget.Switch) AppOpEntry(com.android.settings.applications.AppOpsState.AppOpEntry)

Aggregations

AppOpsManager (android.app.AppOpsManager)1 Switch (android.widget.Switch)1 AppOpEntry (com.android.settings.applications.AppOpsState.AppOpEntry)1