Merge "Add internal implementation for notifyPackageUse" into oc-mr1-dev

This commit is contained in:
TreeHugger Robot
2017-09-05 16:28:13 +00:00
committed by Android (Google) Code Review
3 changed files with 23 additions and 9 deletions

View File

@@ -378,4 +378,9 @@ public abstract class PackageManagerInternal {
* associated with an instant app. It may be kept after the instant app has been uninstalled.
*/
public abstract boolean hasInstantApplicationMetadata(String packageName, int userId);
/**
* Updates a package last used time.
*/
public abstract void notifyPackageUse(String packageName, int reason);
}

View File

@@ -3588,10 +3588,8 @@ public class ActivityManagerService extends IActivityManager.Stub
}
void notifyPackageUse(String packageName, int reason) {
IPackageManager pm = AppGlobals.getPackageManager();
try {
pm.notifyPackageUse(packageName, reason);
} catch (RemoteException e) {
synchronized(this) {
getPackageManagerInternalLocked().notifyPackageUse(packageName, reason);
}
}

View File

@@ -9844,14 +9844,18 @@ public class PackageManagerService extends IPackageManager.Stub
return;
}
}
final PackageParser.Package p = mPackages.get(packageName);
if (p == null) {
return;
}
p.mLastPackageUsageTimeInMills[reason] = System.currentTimeMillis();
notifyPackageUseLocked(packageName, reason);
}
}
private void notifyPackageUseLocked(String packageName, int reason) {
final PackageParser.Package p = mPackages.get(packageName);
if (p == null) {
return;
}
p.mLastPackageUsageTimeInMills[reason] = System.currentTimeMillis();
}
@Override
public void notifyDexLoad(String loadingPackageName, List<String> classLoaderNames,
List<String> classPaths, String loaderIsa) {
@@ -25502,6 +25506,13 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
return mInstantAppRegistry.hasInstantApplicationMetadataLPr(packageName, userId);
}
}
@Override
public void notifyPackageUse(String packageName, int reason) {
synchronized (mPackages) {
PackageManagerService.this.notifyPackageUseLocked(packageName, reason);
}
}
}
@Override