Loading core/java/com/android/internal/compat/IPlatformCompat.aidl +5 −3 Original line number Diff line number Diff line Loading @@ -49,9 +49,10 @@ interface IPlatformCompat * you do not need to call this API directly. The change will be reported for you. * * @param changeId The ID of the compatibility change taking effect. * @param userId The ID of the user that the operation is done for. * @param packageName The package name of the app in question. */ void reportChangeByPackageName(long changeId, in String packageName); void reportChangeByPackageName(long changeId, in String packageName, int userId); /** * Reports that a compatibility change is affecting an app process now. Loading Loading @@ -86,7 +87,7 @@ interface IPlatformCompat * be called when implementing functionality on behalf of the affected app. * * <p>Same as {@link #isChangeEnabled(long, ApplicationInfo)}, except it receives a package name * instead of an {@link ApplicationInfo} * and userId instead of an {@link ApplicationInfo} * object, and finds an app info object based on the package name. Returns {@code true} if * there is no installed package by that name. * Loading @@ -100,9 +101,10 @@ interface IPlatformCompat * * @param changeId The ID of the compatibility change in question. * @param packageName The package name of the app in question. * @param userId The ID of the user that the operation is done for. * @return {@code true} if the change is enabled for the current app. */ boolean isChangeEnabledByPackageName(long changeId, in String packageName); boolean isChangeEnabledByPackageName(long changeId, in String packageName, int userId); /** * Query if a given compatibility change is enabled for an app process. This method should Loading native/android/aidl/com/android/internal/compat/IPlatformCompatNative.aidl +4 −2 Original line number Diff line number Diff line Loading @@ -33,9 +33,10 @@ interface IPlatformCompatNative * you do not need to call this API directly. The change will be reported for you. * * @param changeId The ID of the compatibility change taking effect. * @param userId The ID of the user that the operation is done for. * @param packageName The package name of the app in question. */ void reportChangeByPackageName(long changeId, @utf8InCpp String packageName); void reportChangeByPackageName(long changeId, @utf8InCpp String packageName, int userId); /** * Reports that a compatibility change is affecting an app process now. Loading Loading @@ -64,9 +65,10 @@ interface IPlatformCompatNative * * @param changeId The ID of the compatibility change in question. * @param packageName The package name of the app in question. * @param userId The ID of the user that the operation is done for. * @return {@code true} if the change is enabled for the current app. */ boolean isChangeEnabledByPackageName(long changeId, @utf8InCpp String packageName); boolean isChangeEnabledByPackageName(long changeId, @utf8InCpp String packageName, int userId); /** * Query if a given compatibility change is enabled for an app process. This method should Loading services/core/java/com/android/server/compat/PlatformCompat.java +9 −9 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ package com.android.server.compat; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.os.Process; import android.os.UserHandle; import android.util.Slog; import android.util.StatsLog; Loading Loading @@ -54,8 +54,8 @@ public class PlatformCompat extends IPlatformCompat.Stub { } @Override public void reportChangeByPackageName(long changeId, String packageName) { ApplicationInfo appInfo = getApplicationInfo(packageName); public void reportChangeByPackageName(long changeId, String packageName, int userId) { ApplicationInfo appInfo = getApplicationInfo(packageName, userId); if (appInfo == null) { return; } Loading @@ -80,8 +80,8 @@ public class PlatformCompat extends IPlatformCompat.Stub { } @Override public boolean isChangeEnabledByPackageName(long changeId, String packageName) { ApplicationInfo appInfo = getApplicationInfo(packageName); public boolean isChangeEnabledByPackageName(long changeId, String packageName, int userId) { ApplicationInfo appInfo = getApplicationInfo(packageName, userId); if (appInfo == null) { return true; } Loading @@ -96,7 +96,8 @@ public class PlatformCompat extends IPlatformCompat.Stub { } boolean enabled = true; for (String packageName : packages) { enabled = enabled && isChangeEnabledByPackageName(changeId, packageName); enabled = enabled && isChangeEnabledByPackageName(changeId, packageName, UserHandle.getUserId(uid)); } return enabled; } Loading Loading @@ -127,10 +128,9 @@ public class PlatformCompat extends IPlatformCompat.Stub { mChangeReporter.resetReportedChanges(appInfo.uid); } private ApplicationInfo getApplicationInfo(String packageName) { private ApplicationInfo getApplicationInfo(String packageName, int userId) { try { return mContext.getPackageManager().getApplicationInfoAsUser(packageName, 0, Process.myUid()); return mContext.getPackageManager().getApplicationInfoAsUser(packageName, 0, userId); } catch (PackageManager.NameNotFoundException e) { Slog.e(TAG, "No installed package " + packageName); } Loading services/core/java/com/android/server/compat/PlatformCompatNative.java +4 −4 Original line number Diff line number Diff line Loading @@ -29,8 +29,8 @@ public class PlatformCompatNative extends IPlatformCompatNative.Stub { } @Override public void reportChangeByPackageName(long changeId, String packageName) { mPlatformCompat.reportChangeByPackageName(changeId, packageName); public void reportChangeByPackageName(long changeId, String packageName, int userId) { mPlatformCompat.reportChangeByPackageName(changeId, packageName, userId); } @Override Loading @@ -39,8 +39,8 @@ public class PlatformCompatNative extends IPlatformCompatNative.Stub { } @Override public boolean isChangeEnabledByPackageName(long changeId, String packageName) { return mPlatformCompat.isChangeEnabledByPackageName(changeId, packageName); public boolean isChangeEnabledByPackageName(long changeId, String packageName, int userId) { return mPlatformCompat.isChangeEnabledByPackageName(changeId, packageName, userId); } @Override Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -4183,7 +4183,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { private boolean passwordQualityInvocationOrderCheckEnabled(String packageName, int userId) { try { return mIPlatformCompat.isChangeEnabledByPackageName(ADMIN_APP_PASSWORD_COMPLEXITY, packageName); packageName, userId); } catch (RemoteException e) { Log.e(LOG_TAG, "Failed to get a response from PLATFORM_COMPAT_SERVICE", e); } Loading Loading
core/java/com/android/internal/compat/IPlatformCompat.aidl +5 −3 Original line number Diff line number Diff line Loading @@ -49,9 +49,10 @@ interface IPlatformCompat * you do not need to call this API directly. The change will be reported for you. * * @param changeId The ID of the compatibility change taking effect. * @param userId The ID of the user that the operation is done for. * @param packageName The package name of the app in question. */ void reportChangeByPackageName(long changeId, in String packageName); void reportChangeByPackageName(long changeId, in String packageName, int userId); /** * Reports that a compatibility change is affecting an app process now. Loading Loading @@ -86,7 +87,7 @@ interface IPlatformCompat * be called when implementing functionality on behalf of the affected app. * * <p>Same as {@link #isChangeEnabled(long, ApplicationInfo)}, except it receives a package name * instead of an {@link ApplicationInfo} * and userId instead of an {@link ApplicationInfo} * object, and finds an app info object based on the package name. Returns {@code true} if * there is no installed package by that name. * Loading @@ -100,9 +101,10 @@ interface IPlatformCompat * * @param changeId The ID of the compatibility change in question. * @param packageName The package name of the app in question. * @param userId The ID of the user that the operation is done for. * @return {@code true} if the change is enabled for the current app. */ boolean isChangeEnabledByPackageName(long changeId, in String packageName); boolean isChangeEnabledByPackageName(long changeId, in String packageName, int userId); /** * Query if a given compatibility change is enabled for an app process. This method should Loading
native/android/aidl/com/android/internal/compat/IPlatformCompatNative.aidl +4 −2 Original line number Diff line number Diff line Loading @@ -33,9 +33,10 @@ interface IPlatformCompatNative * you do not need to call this API directly. The change will be reported for you. * * @param changeId The ID of the compatibility change taking effect. * @param userId The ID of the user that the operation is done for. * @param packageName The package name of the app in question. */ void reportChangeByPackageName(long changeId, @utf8InCpp String packageName); void reportChangeByPackageName(long changeId, @utf8InCpp String packageName, int userId); /** * Reports that a compatibility change is affecting an app process now. Loading Loading @@ -64,9 +65,10 @@ interface IPlatformCompatNative * * @param changeId The ID of the compatibility change in question. * @param packageName The package name of the app in question. * @param userId The ID of the user that the operation is done for. * @return {@code true} if the change is enabled for the current app. */ boolean isChangeEnabledByPackageName(long changeId, @utf8InCpp String packageName); boolean isChangeEnabledByPackageName(long changeId, @utf8InCpp String packageName, int userId); /** * Query if a given compatibility change is enabled for an app process. This method should Loading
services/core/java/com/android/server/compat/PlatformCompat.java +9 −9 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ package com.android.server.compat; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.os.Process; import android.os.UserHandle; import android.util.Slog; import android.util.StatsLog; Loading Loading @@ -54,8 +54,8 @@ public class PlatformCompat extends IPlatformCompat.Stub { } @Override public void reportChangeByPackageName(long changeId, String packageName) { ApplicationInfo appInfo = getApplicationInfo(packageName); public void reportChangeByPackageName(long changeId, String packageName, int userId) { ApplicationInfo appInfo = getApplicationInfo(packageName, userId); if (appInfo == null) { return; } Loading @@ -80,8 +80,8 @@ public class PlatformCompat extends IPlatformCompat.Stub { } @Override public boolean isChangeEnabledByPackageName(long changeId, String packageName) { ApplicationInfo appInfo = getApplicationInfo(packageName); public boolean isChangeEnabledByPackageName(long changeId, String packageName, int userId) { ApplicationInfo appInfo = getApplicationInfo(packageName, userId); if (appInfo == null) { return true; } Loading @@ -96,7 +96,8 @@ public class PlatformCompat extends IPlatformCompat.Stub { } boolean enabled = true; for (String packageName : packages) { enabled = enabled && isChangeEnabledByPackageName(changeId, packageName); enabled = enabled && isChangeEnabledByPackageName(changeId, packageName, UserHandle.getUserId(uid)); } return enabled; } Loading Loading @@ -127,10 +128,9 @@ public class PlatformCompat extends IPlatformCompat.Stub { mChangeReporter.resetReportedChanges(appInfo.uid); } private ApplicationInfo getApplicationInfo(String packageName) { private ApplicationInfo getApplicationInfo(String packageName, int userId) { try { return mContext.getPackageManager().getApplicationInfoAsUser(packageName, 0, Process.myUid()); return mContext.getPackageManager().getApplicationInfoAsUser(packageName, 0, userId); } catch (PackageManager.NameNotFoundException e) { Slog.e(TAG, "No installed package " + packageName); } Loading
services/core/java/com/android/server/compat/PlatformCompatNative.java +4 −4 Original line number Diff line number Diff line Loading @@ -29,8 +29,8 @@ public class PlatformCompatNative extends IPlatformCompatNative.Stub { } @Override public void reportChangeByPackageName(long changeId, String packageName) { mPlatformCompat.reportChangeByPackageName(changeId, packageName); public void reportChangeByPackageName(long changeId, String packageName, int userId) { mPlatformCompat.reportChangeByPackageName(changeId, packageName, userId); } @Override Loading @@ -39,8 +39,8 @@ public class PlatformCompatNative extends IPlatformCompatNative.Stub { } @Override public boolean isChangeEnabledByPackageName(long changeId, String packageName) { return mPlatformCompat.isChangeEnabledByPackageName(changeId, packageName); public boolean isChangeEnabledByPackageName(long changeId, String packageName, int userId) { return mPlatformCompat.isChangeEnabledByPackageName(changeId, packageName, userId); } @Override Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -4183,7 +4183,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { private boolean passwordQualityInvocationOrderCheckEnabled(String packageName, int userId) { try { return mIPlatformCompat.isChangeEnabledByPackageName(ADMIN_APP_PASSWORD_COMPLEXITY, packageName); packageName, userId); } catch (RemoteException e) { Log.e(LOG_TAG, "Failed to get a response from PLATFORM_COMPAT_SERVICE", e); } Loading