Merge "Remove isPackageInstalled" into nyc-dev

am: 05bdf88bdf

* commit '05bdf88bdfed76f01a1db8eb73b57a43d939f512':
  Remove isPackageInstalled
This commit is contained in:
Fyodor Kupolov
2016-02-17 20:35:27 +00:00
committed by android-build-merger

View File

@@ -1749,16 +1749,6 @@ public class UserManagerService extends IUserManager.Stub {
} }
} }
private boolean isPackageInstalled(String pkg, int userId) {
final ApplicationInfo info = mPm.getApplicationInfo(pkg,
PackageManager.GET_UNINSTALLED_PACKAGES,
userId);
if (info == null || (info.flags&ApplicationInfo.FLAG_INSTALLED) == 0) {
return false;
}
return true;
}
/** /**
* Removes the app restrictions file for a specific package and user id, if it exists. * Removes the app restrictions file for a specific package and user id, if it exists.
*/ */
@@ -2210,20 +2200,18 @@ public class UserManagerService extends IUserManager.Stub {
} }
} }
if (isPackageInstalled(packageName, userId)) {
// Notify package of changes via an intent - only sent to explicitly registered receivers. // Notify package of changes via an intent - only sent to explicitly registered receivers.
Intent changeIntent = new Intent(Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED); Intent changeIntent = new Intent(Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED);
changeIntent.setPackage(packageName); changeIntent.setPackage(packageName);
changeIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); changeIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
mContext.sendBroadcastAsUser(changeIntent, new UserHandle(userId)); mContext.sendBroadcastAsUser(changeIntent, UserHandle.of(userId));
}
} }
private int getUidForPackage(String packageName) { private int getUidForPackage(String packageName) {
long ident = Binder.clearCallingIdentity(); long ident = Binder.clearCallingIdentity();
try { try {
return mContext.getPackageManager().getApplicationInfo(packageName, return mContext.getPackageManager().getApplicationInfo(packageName,
PackageManager.GET_UNINSTALLED_PACKAGES).uid; PackageManager.MATCH_UNINSTALLED_PACKAGES).uid;
} catch (NameNotFoundException nnfe) { } catch (NameNotFoundException nnfe) {
return -1; return -1;
} finally { } finally {