Loading packages/SettingsLib/src/com/android/settingslib/RestrictedLockUtils.java +21 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.app.admin.DevicePolicyManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.IPackageManager; import android.content.pm.UserInfo; import android.graphics.Color; Loading Loading @@ -226,6 +227,26 @@ public class RestrictedLockUtils { return null; } /** * Check if an application is suspended. * * @return EnforcedAdmin Object containing the enforced admin component and admin user details, * or {@code null} if the application is not suspended. */ public static EnforcedAdmin checkIfApplicationIsSuspended(Context context, String packageName, int userId) { IPackageManager ipm = AppGlobals.getPackageManager(); try { ApplicationInfo ai = ipm.getApplicationInfo(packageName, 0, userId); if (ai != null && ((ai.flags & ApplicationInfo.FLAG_SUSPENDED) != 0)) { return getProfileOrDeviceOwnerOnCallingUser(context); } } catch (RemoteException e) { // Nothing to do } return null; } /** * Check if account management for a specific type of account is disabled by admin. * Only a profile or device owner can disable account management. So, we check if account Loading Loading
packages/SettingsLib/src/com/android/settingslib/RestrictedLockUtils.java +21 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.app.admin.DevicePolicyManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.IPackageManager; import android.content.pm.UserInfo; import android.graphics.Color; Loading Loading @@ -226,6 +227,26 @@ public class RestrictedLockUtils { return null; } /** * Check if an application is suspended. * * @return EnforcedAdmin Object containing the enforced admin component and admin user details, * or {@code null} if the application is not suspended. */ public static EnforcedAdmin checkIfApplicationIsSuspended(Context context, String packageName, int userId) { IPackageManager ipm = AppGlobals.getPackageManager(); try { ApplicationInfo ai = ipm.getApplicationInfo(packageName, 0, userId); if (ai != null && ((ai.flags & ApplicationInfo.FLAG_SUSPENDED) != 0)) { return getProfileOrDeviceOwnerOnCallingUser(context); } } catch (RemoteException e) { // Nothing to do } return null; } /** * Check if account management for a specific type of account is disabled by admin. * Only a profile or device owner can disable account management. So, we check if account Loading