Wired remaining SpecialAppAccess for ECM.
This change enables the remaining settings for ECM, and adds tests for both this and previous ECM changes. Bug: 297372999 Test: Tested on device Test: atest SpaPrivilegedLibTests Test: atest com.android.settings.applications.specialaccess.notificationaccess Test: atest com.android.settings.datausage Test: atest PremiumSmsAccessTest Test: atest RestrictedPreferenceHelperTest Change-Id: I73d39d765dba0c1a75111c37b29ccf1c85d2cdd8
This commit is contained in:
@@ -15,9 +15,12 @@
|
||||
*/
|
||||
package com.android.settings.testutils.shadow;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.UserIdInt;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.android.internal.util.ArrayUtils;
|
||||
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
||||
@@ -38,6 +41,8 @@ public class ShadowRestrictedLockUtilsInternal {
|
||||
private static DevicePolicyManager sDevicePolicyManager;
|
||||
private static String[] sDisabledTypes;
|
||||
private static int sKeyguardDisabledFeatures;
|
||||
private static String[] sEcmRestrictedPkgs;
|
||||
private static boolean sAccessibilityServiceRestricted;
|
||||
|
||||
@Resetter
|
||||
public static void reset() {
|
||||
@@ -47,6 +52,8 @@ public class ShadowRestrictedLockUtilsInternal {
|
||||
sDisabledTypes = new String[0];
|
||||
sMaximumTimeToLockIsSet = false;
|
||||
sMteOverridden = false;
|
||||
sEcmRestrictedPkgs = new String[0];
|
||||
sAccessibilityServiceRestricted = false;
|
||||
}
|
||||
|
||||
@Implementation
|
||||
@@ -108,10 +115,31 @@ public class ShadowRestrictedLockUtilsInternal {
|
||||
return sMteOverridden ? new EnforcedAdmin() : null;
|
||||
}
|
||||
|
||||
public static EnforcedAdmin checkIfAccessibilityServiceDisallowed(Context context,
|
||||
String packageName, int userId) {
|
||||
return sAccessibilityServiceRestricted ? new EnforcedAdmin() : null;
|
||||
}
|
||||
|
||||
@Implementation
|
||||
public static Intent checkIfRequiresEnhancedConfirmation(@NonNull Context context,
|
||||
@NonNull String restriction,
|
||||
int uid,
|
||||
@Nullable String packageName) {
|
||||
if (ArrayUtils.contains(sEcmRestrictedPkgs, packageName)) {
|
||||
return new Intent();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void setRestricted(boolean restricted) {
|
||||
sIsRestricted = restricted;
|
||||
}
|
||||
|
||||
public static void setEcmRestrictedPkgs(String... pkgs) {
|
||||
sEcmRestrictedPkgs = pkgs;
|
||||
}
|
||||
|
||||
public static void setRestrictedPkgs(String... pkgs) {
|
||||
sRestrictedPkgs = pkgs;
|
||||
}
|
||||
|
Reference in New Issue
Block a user