Merge "DO NOT MERGE Ensure package names read from config are system packages." into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d48077745e
@@ -20710,7 +20710,29 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
|
||||
|
||||
@Override
|
||||
public String getSystemTextClassifierPackageName() {
|
||||
return mContext.getString(R.string.config_defaultTextClassifierPackage);
|
||||
return ensureSystemPackageName(mContext.getString(
|
||||
R.string.config_defaultTextClassifierPackage));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String ensureSystemPackageName(@Nullable String packageName) {
|
||||
if (packageName == null) {
|
||||
return null;
|
||||
}
|
||||
long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
if (getPackageInfo(packageName, MATCH_FACTORY_ONLY, UserHandle.USER_SYSTEM) == null) {
|
||||
PackageInfo packageInfo = getPackageInfo(packageName, 0, UserHandle.USER_SYSTEM);
|
||||
if (packageInfo != null) {
|
||||
EventLog.writeEvent(0x534e4554, "145981139", packageInfo.applicationInfo.uid,
|
||||
"");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
return packageName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user