Loading services/companion/java/com/android/server/companion/devicepresence/DevicePresenceProcessor.java +2 −1 Original line number Diff line number Diff line Loading @@ -830,7 +830,8 @@ public class DevicePresenceProcessor implements AssociationStore.OnChangeListene Slog.e(TAG, "Package is NOT bound."); return; } logDevicePresenceEvent(mContext, deviceProfileOrUuid, packageName, event.getEvent()); logDevicePresenceEvent( userId, mContext, deviceProfileOrUuid, packageName, event.getEvent()); primaryServiceConnector.postOnDevicePresenceEvent(event); } Loading services/companion/java/com/android/server/companion/utils/MetricUtils.java +3 −3 Original line number Diff line number Diff line Loading @@ -163,9 +163,9 @@ public final class MetricUtils { /** * Log device presence event changed. */ public static void logDevicePresenceEvent(Context context, String deviceProfileOrUuid, String packageName, int event) { int uid = getUidFromPackageName(context, packageName); public static void logDevicePresenceEvent(int userId, Context context, String deviceProfileOrUuid, String packageName, int event) { int uid = getUidFromPackageName(userId, context, packageName); if (uid != PACKAGE_NOT_FOUND) { write( DEVICE_PRESENCE_CHANGED, Loading services/companion/java/com/android/server/companion/utils/PackageUtils.java +3 −2 Original line number Diff line number Diff line Loading @@ -270,10 +270,11 @@ public final class PackageUtils { /** * Get UID from a packageName. Return -1 if the package is not found. */ public static int getUidFromPackageName(Context context, String packageName) { public static int getUidFromPackageName(int userId, Context context, String packageName) { PackageManager packageManager = context.getPackageManager(); try { ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 0); ApplicationInfo applicationInfo = packageManager.getApplicationInfoAsUser( packageName, 0, userId); return applicationInfo.uid; } catch (PackageManager.NameNotFoundException e) { Slog.w(TAG, packageName + " is not found"); Loading Loading
services/companion/java/com/android/server/companion/devicepresence/DevicePresenceProcessor.java +2 −1 Original line number Diff line number Diff line Loading @@ -830,7 +830,8 @@ public class DevicePresenceProcessor implements AssociationStore.OnChangeListene Slog.e(TAG, "Package is NOT bound."); return; } logDevicePresenceEvent(mContext, deviceProfileOrUuid, packageName, event.getEvent()); logDevicePresenceEvent( userId, mContext, deviceProfileOrUuid, packageName, event.getEvent()); primaryServiceConnector.postOnDevicePresenceEvent(event); } Loading
services/companion/java/com/android/server/companion/utils/MetricUtils.java +3 −3 Original line number Diff line number Diff line Loading @@ -163,9 +163,9 @@ public final class MetricUtils { /** * Log device presence event changed. */ public static void logDevicePresenceEvent(Context context, String deviceProfileOrUuid, String packageName, int event) { int uid = getUidFromPackageName(context, packageName); public static void logDevicePresenceEvent(int userId, Context context, String deviceProfileOrUuid, String packageName, int event) { int uid = getUidFromPackageName(userId, context, packageName); if (uid != PACKAGE_NOT_FOUND) { write( DEVICE_PRESENCE_CHANGED, Loading
services/companion/java/com/android/server/companion/utils/PackageUtils.java +3 −2 Original line number Diff line number Diff line Loading @@ -270,10 +270,11 @@ public final class PackageUtils { /** * Get UID from a packageName. Return -1 if the package is not found. */ public static int getUidFromPackageName(Context context, String packageName) { public static int getUidFromPackageName(int userId, Context context, String packageName) { PackageManager packageManager = context.getPackageManager(); try { ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 0); ApplicationInfo applicationInfo = packageManager.getApplicationInfoAsUser( packageName, 0, userId); return applicationInfo.uid; } catch (PackageManager.NameNotFoundException e) { Slog.w(TAG, packageName + " is not found"); Loading