Always return the same result code in access screens
Regardless if the target package exists or not. Test: Launch dnd and NLS screen with valid and invalid packages; ensure the result code is the same for both Bug: 195412179 Change-Id: I1bacd54c2971afb3733ca2f1462bcaabaada300b
This commit is contained in:
@@ -173,7 +173,7 @@ public class NotificationAccessDetails extends DashboardFragment {
|
|||||||
getActivity(), UserManager.DISALLOW_APPS_CONTROL, mUserId);
|
getActivity(), UserManager.DISALLOW_APPS_CONTROL, mUserId);
|
||||||
|
|
||||||
if (!refreshUi()) {
|
if (!refreshUi()) {
|
||||||
setIntentAndFinish(true /* appChanged */);
|
finish();
|
||||||
}
|
}
|
||||||
Preference apps = getPreferenceScreen().findPreference(
|
Preference apps = getPreferenceScreen().findPreference(
|
||||||
use(BridgedAppsLinkPreferenceController.class).getPreferenceKey());
|
use(BridgedAppsLinkPreferenceController.class).getPreferenceKey());
|
||||||
@@ -197,14 +197,6 @@ public class NotificationAccessDetails extends DashboardFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setIntentAndFinish(boolean appChanged) {
|
|
||||||
Log.i(TAG, "appChanged=" + appChanged);
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.putExtra(ManageApplications.APP_CHG, appChanged);
|
|
||||||
SettingsActivity sa = (SettingsActivity) getActivity();
|
|
||||||
sa.finishPreferencePanel(Activity.RESULT_OK, intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void retrieveAppEntry() {
|
protected void retrieveAppEntry() {
|
||||||
final Bundle args = getArguments();
|
final Bundle args = getArguments();
|
||||||
mPackageName = (args != null) ? args.getString(ARG_PACKAGE_NAME) : null;
|
mPackageName = (args != null) ? args.getString(ARG_PACKAGE_NAME) : null;
|
||||||
@@ -228,7 +220,7 @@ public class NotificationAccessDetails extends DashboardFragment {
|
|||||||
PackageManager.GET_SIGNING_CERTIFICATES |
|
PackageManager.GET_SIGNING_CERTIFICATES |
|
||||||
PackageManager.GET_PERMISSIONS, mUserId);
|
PackageManager.GET_PERMISSIONS, mUserId);
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
Log.e(TAG, "Exception when retrieving package:" + mPackageName, e);
|
// oh well
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -53,10 +53,11 @@ public class ZenAccessDetails extends AppInfoWithHeader implements
|
|||||||
// If this app didn't declare this permission in their manifest, don't bother showing UI.
|
// If this app didn't declare this permission in their manifest, don't bother showing UI.
|
||||||
final Set<String> needAccessApps =
|
final Set<String> needAccessApps =
|
||||||
ZenAccessController.getPackagesRequestingNotificationPolicyAccess();
|
ZenAccessController.getPackagesRequestingNotificationPolicyAccess();
|
||||||
if (!needAccessApps.contains(mPackageName)) {
|
if (needAccessApps.contains(mPackageName)) {
|
||||||
return false;
|
updatePreference(context, findPreference(SWITCH_PREF_KEY));
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
updatePreference(context, findPreference(SWITCH_PREF_KEY));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user