@@ -2300,12 +2300,15 @@ boolean setPackageStoppedStateLPw(String packageName, boolean stopped,
23002300 }
23012301
23022302 private List <UserInfo > getAllUsers () {
2303+ long id = Binder .clearCallingIdentity ();
23032304 try {
23042305 return AppGlobals .getPackageManager ().getUsers ();
23052306 } catch (RemoteException re ) {
23062307 // Local to system process, shouldn't happen
23072308 } catch (NullPointerException npe ) {
23082309 // packagemanager not yet initialized
2310+ } finally {
2311+ Binder .restoreCallingIdentity (id );
23092312 }
23102313 return null ;
23112314 }
@@ -2347,6 +2350,7 @@ void dumpPackagesLPr(PrintWriter pw, String packageName, DumpState dumpState) {
23472350 final SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss" );
23482351 final Date date = new Date ();
23492352 boolean printedSomething = false ;
2353+ List <UserInfo > users = getAllUsers ();
23502354 for (final PackageSetting ps : mPackages .values ()) {
23512355 if (packageName != null && !packageName .equals (ps .realName )
23522356 && !packageName .equals (ps .name )) {
@@ -2447,7 +2451,6 @@ void dumpPackagesLPr(PrintWriter pw, String packageName, DumpState dumpState) {
24472451 pw .print (" haveGids=" ); pw .println (ps .haveGids );
24482452 pw .print (" pkgFlags=0x" ); pw .print (Integer .toHexString (ps .pkgFlags ));
24492453 pw .print (" installStatus=" ); pw .print (ps .installStatus );
2450- List <UserInfo > users = getAllUsers ();
24512454 for (UserInfo user : users ) {
24522455 pw .print (" User " ); pw .print (user .id ); pw .print (": " );
24532456 pw .print (" stopped=" );
0 commit comments