Remove ops preference from specific app
Remve below preference in Settings>Apps>Specific app: Display over apps screen> App display on top permisson Usage access> App usage preferences Modify system settings> App modify system settings permission Change-Id: Ib4128e563b0e2739c16136694ce24182f0da6626 Fixes: 72737995 Test: Manual test
This commit is contained in:
@@ -8342,8 +8342,6 @@
|
|||||||
<string name="system_alert_window_access_title">Display over other apps</string>
|
<string name="system_alert_window_access_title">Display over other apps</string>
|
||||||
<!-- Label for setting which controls whether app can display over other apps [CHAR LIMIT=45] -->
|
<!-- Label for setting which controls whether app can display over other apps [CHAR LIMIT=45] -->
|
||||||
<string name="permit_draw_overlay">Allow display over other apps</string>
|
<string name="permit_draw_overlay">Allow display over other apps</string>
|
||||||
<!-- Link to the apps page for SYSTEM_ALERT_WINDOW settings [CHAR LIMIT=45] -->
|
|
||||||
<string name="app_overlay_permission_preference">App display on top permission</string>
|
|
||||||
<!-- Description of allowing overlay setting [CHAR LIMIT=NONE] -->
|
<!-- Description of allowing overlay setting [CHAR LIMIT=NONE] -->
|
||||||
<string name="allow_overlay_description">Allow this app to display on top of other apps you\u2019re using. It may interfere with your use of those apps or change the way they seem to appear or behave.</string>
|
<string name="allow_overlay_description">Allow this app to display on top of other apps you\u2019re using. It may interfere with your use of those apps or change the way they seem to appear or behave.</string>
|
||||||
|
|
||||||
@@ -8385,8 +8383,6 @@
|
|||||||
<string name="write_settings_title">Can modify system settings</string>
|
<string name="write_settings_title">Can modify system settings</string>
|
||||||
<!-- Main settings screen item's title to go into the write system settings screen [CHAR LIMIT=30] -->
|
<!-- Main settings screen item's title to go into the write system settings screen [CHAR LIMIT=30] -->
|
||||||
<string name="write_system_settings">Modify system settings</string>
|
<string name="write_system_settings">Modify system settings</string>
|
||||||
<!-- Link to the apps page for WRITE_SETTINGS settings [CHAR LIMIT=52] -->
|
|
||||||
<string name="write_settings_preference">App modify system settings permission</string>
|
|
||||||
<!-- Label for setting which controls whether app can write system settings [CHAR LIMIT=45] -->
|
<!-- Label for setting which controls whether app can write system settings [CHAR LIMIT=45] -->
|
||||||
<string name="permit_write_settings">Allow modifying system settings</string>
|
<string name="permit_write_settings">Allow modifying system settings</string>
|
||||||
<!-- Description of the write system settings [CHAR LIMIT=NONE] -->
|
<!-- Description of the write system settings [CHAR LIMIT=NONE] -->
|
||||||
|
@@ -20,9 +20,6 @@
|
|||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="app_ops_settings_switch" />
|
android:key="app_ops_settings_switch" />
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="app_ops_settings_preference" />
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="app_ops_settings_description"
|
android:key="app_ops_settings_description"
|
||||||
android:selectable="false" />
|
android:selectable="false" />
|
||||||
|
@@ -22,10 +22,6 @@
|
|||||||
android:key="app_ops_settings_switch"
|
android:key="app_ops_settings_switch"
|
||||||
android:title="@string/permit_draw_overlay"/>
|
android:title="@string/permit_draw_overlay"/>
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="app_ops_settings_preference"
|
|
||||||
android:title="@string/app_overlay_permission_preference"/>
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:summary="@string/allow_overlay_description"
|
android:summary="@string/allow_overlay_description"
|
||||||
android:selectable="false"/>
|
android:selectable="false"/>
|
||||||
|
@@ -22,10 +22,6 @@
|
|||||||
android:key="app_ops_settings_switch"
|
android:key="app_ops_settings_switch"
|
||||||
android:title="@string/permit_write_settings"/>
|
android:title="@string/permit_write_settings"/>
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="app_ops_settings_preference"
|
|
||||||
android:title="@string/write_settings_preference"/>
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:summary="@string/write_settings_description"
|
android:summary="@string/write_settings_description"
|
||||||
android:selectable="false"/>
|
android:selectable="false"/>
|
||||||
|
@@ -45,7 +45,6 @@ public class UsageAccessDetails extends AppInfoWithHeader implements OnPreferenc
|
|||||||
|
|
||||||
private static final String KEY_APP_OPS_PREFERENCE_SCREEN = "app_ops_preference_screen";
|
private static final String KEY_APP_OPS_PREFERENCE_SCREEN = "app_ops_preference_screen";
|
||||||
private static final String KEY_APP_OPS_SETTINGS_SWITCH = "app_ops_settings_switch";
|
private static final String KEY_APP_OPS_SETTINGS_SWITCH = "app_ops_settings_switch";
|
||||||
private static final String KEY_APP_OPS_SETTINGS_PREFS = "app_ops_settings_preference";
|
|
||||||
private static final String KEY_APP_OPS_SETTINGS_DESC = "app_ops_settings_description";
|
private static final String KEY_APP_OPS_SETTINGS_DESC = "app_ops_settings_description";
|
||||||
|
|
||||||
// Use a bridge to get the usage stats but don't initialize it to connect with all state.
|
// Use a bridge to get the usage stats but don't initialize it to connect with all state.
|
||||||
@@ -53,7 +52,6 @@ public class UsageAccessDetails extends AppInfoWithHeader implements OnPreferenc
|
|||||||
private AppStateUsageBridge mUsageBridge;
|
private AppStateUsageBridge mUsageBridge;
|
||||||
private AppOpsManager mAppOpsManager;
|
private AppOpsManager mAppOpsManager;
|
||||||
private SwitchPreference mSwitchPref;
|
private SwitchPreference mSwitchPref;
|
||||||
private Preference mUsagePrefs;
|
|
||||||
private Preference mUsageDesc;
|
private Preference mUsageDesc;
|
||||||
private Intent mSettingsIntent;
|
private Intent mSettingsIntent;
|
||||||
private UsageState mUsageState;
|
private UsageState mUsageState;
|
||||||
@@ -70,16 +68,13 @@ public class UsageAccessDetails extends AppInfoWithHeader implements OnPreferenc
|
|||||||
|
|
||||||
addPreferencesFromResource(R.xml.app_ops_permissions_details);
|
addPreferencesFromResource(R.xml.app_ops_permissions_details);
|
||||||
mSwitchPref = (SwitchPreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
|
mSwitchPref = (SwitchPreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
|
||||||
mUsagePrefs = findPreference(KEY_APP_OPS_SETTINGS_PREFS);
|
|
||||||
mUsageDesc = findPreference(KEY_APP_OPS_SETTINGS_DESC);
|
mUsageDesc = findPreference(KEY_APP_OPS_SETTINGS_DESC);
|
||||||
|
|
||||||
getPreferenceScreen().setTitle(R.string.usage_access);
|
getPreferenceScreen().setTitle(R.string.usage_access);
|
||||||
mSwitchPref.setTitle(R.string.permit_usage_access);
|
mSwitchPref.setTitle(R.string.permit_usage_access);
|
||||||
mUsagePrefs.setTitle(R.string.app_usage_preference);
|
|
||||||
mUsageDesc.setSummary(R.string.usage_access_description);
|
mUsageDesc.setSummary(R.string.usage_access_description);
|
||||||
|
|
||||||
mSwitchPref.setOnPreferenceChangeListener(this);
|
mSwitchPref.setOnPreferenceChangeListener(this);
|
||||||
mUsagePrefs.setOnPreferenceClickListener(this);
|
|
||||||
|
|
||||||
mSettingsIntent = new Intent(Intent.ACTION_MAIN)
|
mSettingsIntent = new Intent(Intent.ACTION_MAIN)
|
||||||
.addCategory(Settings.INTENT_CATEGORY_USAGE_ACCESS_CONFIG)
|
.addCategory(Settings.INTENT_CATEGORY_USAGE_ACCESS_CONFIG)
|
||||||
@@ -88,16 +83,6 @@ public class UsageAccessDetails extends AppInfoWithHeader implements OnPreferenc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
if (preference == mUsagePrefs) {
|
|
||||||
if (mSettingsIntent != null) {
|
|
||||||
try {
|
|
||||||
getActivity().startActivityAsUser(mSettingsIntent, new UserHandle(mUserId));
|
|
||||||
} catch (ActivityNotFoundException e) {
|
|
||||||
Log.w(TAG, "Unable to launch app usage access settings " + mSettingsIntent, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,14 +135,10 @@ public class UsageAccessDetails extends AppInfoWithHeader implements OnPreferenc
|
|||||||
boolean hasAccess = mUsageState.isPermissible();
|
boolean hasAccess = mUsageState.isPermissible();
|
||||||
mSwitchPref.setChecked(hasAccess);
|
mSwitchPref.setChecked(hasAccess);
|
||||||
mSwitchPref.setEnabled(mUsageState.permissionDeclared);
|
mSwitchPref.setEnabled(mUsageState.permissionDeclared);
|
||||||
mUsagePrefs.setEnabled(hasAccess);
|
|
||||||
|
|
||||||
ResolveInfo resolveInfo = mPm.resolveActivityAsUser(mSettingsIntent,
|
ResolveInfo resolveInfo = mPm.resolveActivityAsUser(mSettingsIntent,
|
||||||
PackageManager.GET_META_DATA, mUserId);
|
PackageManager.GET_META_DATA, mUserId);
|
||||||
if (resolveInfo != null) {
|
if (resolveInfo != null) {
|
||||||
if (findPreference(KEY_APP_OPS_SETTINGS_PREFS) == null) {
|
|
||||||
getPreferenceScreen().addPreference(mUsagePrefs);
|
|
||||||
}
|
|
||||||
Bundle metaData = resolveInfo.activityInfo.metaData;
|
Bundle metaData = resolveInfo.activityInfo.metaData;
|
||||||
mSettingsIntent.setComponent(new ComponentName(resolveInfo.activityInfo.packageName,
|
mSettingsIntent.setComponent(new ComponentName(resolveInfo.activityInfo.packageName,
|
||||||
resolveInfo.activityInfo.name));
|
resolveInfo.activityInfo.name));
|
||||||
@@ -166,10 +147,6 @@ public class UsageAccessDetails extends AppInfoWithHeader implements OnPreferenc
|
|||||||
mSwitchPref.setSummary(
|
mSwitchPref.setSummary(
|
||||||
metaData.getString(Settings.METADATA_USAGE_ACCESS_REASON));
|
metaData.getString(Settings.METADATA_USAGE_ACCESS_REASON));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (findPreference(KEY_APP_OPS_SETTINGS_PREFS) != null) {
|
|
||||||
getPreferenceScreen().removePreference(mUsagePrefs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -49,7 +49,6 @@ public class DrawOverlayDetails extends AppInfoWithHeader implements OnPreferenc
|
|||||||
OnPreferenceClickListener {
|
OnPreferenceClickListener {
|
||||||
|
|
||||||
private static final String KEY_APP_OPS_SETTINGS_SWITCH = "app_ops_settings_switch";
|
private static final String KEY_APP_OPS_SETTINGS_SWITCH = "app_ops_settings_switch";
|
||||||
private static final String KEY_APP_OPS_SETTINGS_PREFS = "app_ops_settings_preference";
|
|
||||||
private static final String LOG_TAG = "DrawOverlayDetails";
|
private static final String LOG_TAG = "DrawOverlayDetails";
|
||||||
|
|
||||||
private static final int [] APP_OPS_OP_CODE = {
|
private static final int [] APP_OPS_OP_CODE = {
|
||||||
@@ -61,7 +60,6 @@ public class DrawOverlayDetails extends AppInfoWithHeader implements OnPreferenc
|
|||||||
private AppStateOverlayBridge mOverlayBridge;
|
private AppStateOverlayBridge mOverlayBridge;
|
||||||
private AppOpsManager mAppOpsManager;
|
private AppOpsManager mAppOpsManager;
|
||||||
private SwitchPreference mSwitchPref;
|
private SwitchPreference mSwitchPref;
|
||||||
private Preference mOverlayPrefs;
|
|
||||||
private Intent mSettingsIntent;
|
private Intent mSettingsIntent;
|
||||||
private OverlayState mOverlayState;
|
private OverlayState mOverlayState;
|
||||||
|
|
||||||
@@ -76,11 +74,9 @@ public class DrawOverlayDetails extends AppInfoWithHeader implements OnPreferenc
|
|||||||
// find preferences
|
// find preferences
|
||||||
addPreferencesFromResource(R.xml.draw_overlay_permissions_details);
|
addPreferencesFromResource(R.xml.draw_overlay_permissions_details);
|
||||||
mSwitchPref = (SwitchPreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
|
mSwitchPref = (SwitchPreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
|
||||||
mOverlayPrefs = findPreference(KEY_APP_OPS_SETTINGS_PREFS);
|
|
||||||
|
|
||||||
// install event listeners
|
// install event listeners
|
||||||
mSwitchPref.setOnPreferenceChangeListener(this);
|
mSwitchPref.setOnPreferenceChangeListener(this);
|
||||||
mOverlayPrefs.setOnPreferenceClickListener(this);
|
|
||||||
|
|
||||||
mSettingsIntent = new Intent(Intent.ACTION_MAIN)
|
mSettingsIntent = new Intent(Intent.ACTION_MAIN)
|
||||||
.setAction(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
|
.setAction(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
|
||||||
@@ -109,17 +105,6 @@ public class DrawOverlayDetails extends AppInfoWithHeader implements OnPreferenc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
if (preference == mOverlayPrefs) {
|
|
||||||
if (mSettingsIntent != null) {
|
|
||||||
try {
|
|
||||||
getActivity().startActivityAsUser(mSettingsIntent, new UserHandle(mUserId));
|
|
||||||
} catch (ActivityNotFoundException e) {
|
|
||||||
Log.w(LOG_TAG, "Unable to launch app draw overlay settings " + mSettingsIntent,
|
|
||||||
e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,15 +144,9 @@ public class DrawOverlayDetails extends AppInfoWithHeader implements OnPreferenc
|
|||||||
mSwitchPref.setChecked(isAllowed);
|
mSwitchPref.setChecked(isAllowed);
|
||||||
// you cannot ask a user to grant you a permission you did not have!
|
// you cannot ask a user to grant you a permission you did not have!
|
||||||
mSwitchPref.setEnabled(mOverlayState.permissionDeclared && mOverlayState.controlEnabled);
|
mSwitchPref.setEnabled(mOverlayState.permissionDeclared && mOverlayState.controlEnabled);
|
||||||
mOverlayPrefs.setEnabled(isAllowed);
|
|
||||||
|
|
||||||
ResolveInfo resolveInfo = mPm.resolveActivityAsUser(mSettingsIntent,
|
ResolveInfo resolveInfo = mPm.resolveActivityAsUser(mSettingsIntent,
|
||||||
PackageManager.GET_META_DATA, mUserId);
|
PackageManager.GET_META_DATA, mUserId);
|
||||||
if (resolveInfo == null) {
|
|
||||||
if (findPreference(KEY_APP_OPS_SETTINGS_PREFS) != null) {
|
|
||||||
getPreferenceScreen().removePreference(mOverlayPrefs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -45,7 +45,6 @@ public class WriteSettingsDetails extends AppInfoWithHeader implements OnPrefere
|
|||||||
|
|
||||||
private static final String KEY_APP_OPS_PREFERENCE_SCREEN = "app_ops_preference_screen";
|
private static final String KEY_APP_OPS_PREFERENCE_SCREEN = "app_ops_preference_screen";
|
||||||
private static final String KEY_APP_OPS_SETTINGS_SWITCH = "app_ops_settings_switch";
|
private static final String KEY_APP_OPS_SETTINGS_SWITCH = "app_ops_settings_switch";
|
||||||
private static final String KEY_APP_OPS_SETTINGS_PREFS = "app_ops_settings_preference";
|
|
||||||
private static final String LOG_TAG = "WriteSettingsDetails";
|
private static final String LOG_TAG = "WriteSettingsDetails";
|
||||||
|
|
||||||
private static final int [] APP_OPS_OP_CODE = {
|
private static final int [] APP_OPS_OP_CODE = {
|
||||||
@@ -57,7 +56,6 @@ public class WriteSettingsDetails extends AppInfoWithHeader implements OnPrefere
|
|||||||
private AppStateWriteSettingsBridge mAppBridge;
|
private AppStateWriteSettingsBridge mAppBridge;
|
||||||
private AppOpsManager mAppOpsManager;
|
private AppOpsManager mAppOpsManager;
|
||||||
private SwitchPreference mSwitchPref;
|
private SwitchPreference mSwitchPref;
|
||||||
private Preference mWriteSettingsPrefs;
|
|
||||||
private Intent mSettingsIntent;
|
private Intent mSettingsIntent;
|
||||||
private WriteSettingsState mWriteSettingsState;
|
private WriteSettingsState mWriteSettingsState;
|
||||||
|
|
||||||
@@ -71,10 +69,8 @@ public class WriteSettingsDetails extends AppInfoWithHeader implements OnPrefere
|
|||||||
|
|
||||||
addPreferencesFromResource(R.xml.write_system_settings_permissions_details);
|
addPreferencesFromResource(R.xml.write_system_settings_permissions_details);
|
||||||
mSwitchPref = (SwitchPreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
|
mSwitchPref = (SwitchPreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
|
||||||
mWriteSettingsPrefs = findPreference(KEY_APP_OPS_SETTINGS_PREFS);
|
|
||||||
|
|
||||||
mSwitchPref.setOnPreferenceChangeListener(this);
|
mSwitchPref.setOnPreferenceChangeListener(this);
|
||||||
mWriteSettingsPrefs.setOnPreferenceClickListener(this);
|
|
||||||
|
|
||||||
mSettingsIntent = new Intent(Intent.ACTION_MAIN)
|
mSettingsIntent = new Intent(Intent.ACTION_MAIN)
|
||||||
.addCategory(Settings.INTENT_CATEGORY_USAGE_ACCESS_CONFIG)
|
.addCategory(Settings.INTENT_CATEGORY_USAGE_ACCESS_CONFIG)
|
||||||
@@ -83,16 +79,6 @@ public class WriteSettingsDetails extends AppInfoWithHeader implements OnPrefere
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
if (preference == mWriteSettingsPrefs) {
|
|
||||||
if (mSettingsIntent != null) {
|
|
||||||
try {
|
|
||||||
getActivity().startActivityAsUser(mSettingsIntent, new UserHandle(mUserId));
|
|
||||||
} catch (ActivityNotFoundException e) {
|
|
||||||
Log.w(LOG_TAG, "Unable to launch write system settings " + mSettingsIntent, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,15 +128,9 @@ public class WriteSettingsDetails extends AppInfoWithHeader implements OnPrefere
|
|||||||
mSwitchPref.setChecked(canWrite);
|
mSwitchPref.setChecked(canWrite);
|
||||||
// you can't ask a user for a permission you didn't even declare!
|
// you can't ask a user for a permission you didn't even declare!
|
||||||
mSwitchPref.setEnabled(mWriteSettingsState.permissionDeclared);
|
mSwitchPref.setEnabled(mWriteSettingsState.permissionDeclared);
|
||||||
mWriteSettingsPrefs.setEnabled(canWrite);
|
|
||||||
|
|
||||||
ResolveInfo resolveInfo = mPm.resolveActivityAsUser(mSettingsIntent,
|
ResolveInfo resolveInfo = mPm.resolveActivityAsUser(mSettingsIntent,
|
||||||
PackageManager.GET_META_DATA, mUserId);
|
PackageManager.GET_META_DATA, mUserId);
|
||||||
if (resolveInfo == null) {
|
|
||||||
if (getPreferenceScreen().findPreference(KEY_APP_OPS_SETTINGS_PREFS) != null) {
|
|
||||||
getPreferenceScreen().removePreference(mWriteSettingsPrefs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user