Loading services/core/java/com/android/server/pm/PackageManagerShellCommand.java +4 −7 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import android.accounts.IAccountManager; import android.annotation.UserIdInt; import android.app.ActivityManager; import android.app.ActivityManagerInternal; import android.app.role.IRoleManager; import android.app.role.RoleManager; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -80,7 +79,6 @@ import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor.AutoCloseInputStream; import android.os.PersistableBundle; import android.os.Process; import android.os.RemoteCallback; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceSpecificException; Loading @@ -106,6 +104,7 @@ import com.android.internal.content.PackageHelper; import com.android.internal.util.ArrayUtils; import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.Preconditions; import com.android.server.FgThread; import com.android.server.LocalServices; import com.android.server.SystemConfig; import com.android.server.pm.PackageManagerShellCommandDataLoader.Metadata; Loading Loading @@ -2971,12 +2970,10 @@ class PackageManagerShellCommand extends ShellCommand { final int translatedUserId = translateUserId(userId, UserHandle.USER_NULL, "runSetHomeActivity"); final CompletableFuture<Boolean> future = new CompletableFuture<>(); final RemoteCallback callback = new RemoteCallback(res -> future.complete(res != null)); try { IRoleManager roleManager = android.app.role.IRoleManager.Stub.asInterface( ServiceManager.getServiceOrThrow(Context.ROLE_SERVICE)); roleManager.addRoleHolderAsUser(RoleManager.ROLE_HOME, pkgName, 0, translatedUserId, callback); RoleManager roleManager = mContext.getSystemService(RoleManager.class); roleManager.addRoleHolderAsUser(RoleManager.ROLE_HOME, pkgName, 0, UserHandle.of(translatedUserId), FgThread.getExecutor(), future::complete); boolean success = future.get(); if (success) { pw.println("Success"); Loading services/core/java/com/android/server/role/RoleManagerService.java +0 −13 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManagerInternal; import android.content.pm.Signature; Loading Loading @@ -754,18 +753,6 @@ public class RoleManagerService extends SystemService implements RoleUserState.C dumpOutputStream.flush(); } private int getUidForPackage(String packageName) { final long ident = Binder.clearCallingIdentity(); try { return getContext().getPackageManager().getApplicationInfo(packageName, PackageManager.MATCH_ANY_USER).uid; } catch (NameNotFoundException nnfe) { return -1; } finally { Binder.restoreCallingIdentity(ident); } } } private class Internal extends RoleManagerInternal { Loading Loading
services/core/java/com/android/server/pm/PackageManagerShellCommand.java +4 −7 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import android.accounts.IAccountManager; import android.annotation.UserIdInt; import android.app.ActivityManager; import android.app.ActivityManagerInternal; import android.app.role.IRoleManager; import android.app.role.RoleManager; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -80,7 +79,6 @@ import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor.AutoCloseInputStream; import android.os.PersistableBundle; import android.os.Process; import android.os.RemoteCallback; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceSpecificException; Loading @@ -106,6 +104,7 @@ import com.android.internal.content.PackageHelper; import com.android.internal.util.ArrayUtils; import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.Preconditions; import com.android.server.FgThread; import com.android.server.LocalServices; import com.android.server.SystemConfig; import com.android.server.pm.PackageManagerShellCommandDataLoader.Metadata; Loading Loading @@ -2971,12 +2970,10 @@ class PackageManagerShellCommand extends ShellCommand { final int translatedUserId = translateUserId(userId, UserHandle.USER_NULL, "runSetHomeActivity"); final CompletableFuture<Boolean> future = new CompletableFuture<>(); final RemoteCallback callback = new RemoteCallback(res -> future.complete(res != null)); try { IRoleManager roleManager = android.app.role.IRoleManager.Stub.asInterface( ServiceManager.getServiceOrThrow(Context.ROLE_SERVICE)); roleManager.addRoleHolderAsUser(RoleManager.ROLE_HOME, pkgName, 0, translatedUserId, callback); RoleManager roleManager = mContext.getSystemService(RoleManager.class); roleManager.addRoleHolderAsUser(RoleManager.ROLE_HOME, pkgName, 0, UserHandle.of(translatedUserId), FgThread.getExecutor(), future::complete); boolean success = future.get(); if (success) { pw.println("Success"); Loading
services/core/java/com/android/server/role/RoleManagerService.java +0 −13 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManagerInternal; import android.content.pm.Signature; Loading Loading @@ -754,18 +753,6 @@ public class RoleManagerService extends SystemService implements RoleUserState.C dumpOutputStream.flush(); } private int getUidForPackage(String packageName) { final long ident = Binder.clearCallingIdentity(); try { return getContext().getPackageManager().getApplicationInfo(packageName, PackageManager.MATCH_ANY_USER).uid; } catch (NameNotFoundException nnfe) { return -1; } finally { Binder.restoreCallingIdentity(ident); } } } private class Internal extends RoleManagerInternal { Loading