Merge "Remove usage of mInstallLock." into tm-dev am: 63aeabb693 am: cfbe984f1f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17572689 Change-Id: Ia62d9e9221feaca8f72c9e8c60076852ffe6f7cd Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -45,7 +45,6 @@ import android.util.ArrayMap;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
|
||||||
import com.android.internal.annotations.GuardedBy;
|
|
||||||
import com.android.internal.os.BackgroundThread;
|
import com.android.internal.os.BackgroundThread;
|
||||||
import com.android.internal.os.RoSystemProperties;
|
import com.android.internal.os.RoSystemProperties;
|
||||||
import com.android.internal.util.ArrayUtils;
|
import com.android.internal.util.ArrayUtils;
|
||||||
@@ -94,8 +93,6 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
|
|||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private IPackageManager mPackageManager;
|
private IPackageManager mPackageManager;
|
||||||
private final Object mInstallLock;
|
|
||||||
@GuardedBy("mInstallLock")
|
|
||||||
private final Installer mInstaller;
|
private final Installer mInstaller;
|
||||||
|
|
||||||
private final Handler mHandler;
|
private final Handler mHandler;
|
||||||
@@ -105,10 +102,9 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ArtManagerService(Context context, Installer installer,
|
public ArtManagerService(Context context, Installer installer,
|
||||||
Object installLock) {
|
Object ignored) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mInstaller = installer;
|
mInstaller = installer;
|
||||||
mInstallLock = installLock;
|
|
||||||
mHandler = new Handler(BackgroundThread.getHandler().getLooper());
|
mHandler = new Handler(BackgroundThread.getHandler().getLooper());
|
||||||
|
|
||||||
LocalServices.addService(ArtManagerInternal.class, new ArtManagerInternalImpl());
|
LocalServices.addService(ArtManagerInternal.class, new ArtManagerInternalImpl());
|
||||||
@@ -273,7 +269,6 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
|
|||||||
private void createProfileSnapshot(String packageName, String profileName, String classpath,
|
private void createProfileSnapshot(String packageName, String profileName, String classpath,
|
||||||
int appId, ISnapshotRuntimeProfileCallback callback) {
|
int appId, ISnapshotRuntimeProfileCallback callback) {
|
||||||
// Ask the installer to snapshot the profile.
|
// Ask the installer to snapshot the profile.
|
||||||
synchronized (mInstallLock) {
|
|
||||||
try {
|
try {
|
||||||
if (!mInstaller.createProfileSnapshot(appId, packageName, profileName, classpath)) {
|
if (!mInstaller.createProfileSnapshot(appId, packageName, profileName, classpath)) {
|
||||||
postError(callback, packageName, ArtManager.SNAPSHOT_FAILED_INTERNAL_ERROR);
|
postError(callback, packageName, ArtManager.SNAPSHOT_FAILED_INTERNAL_ERROR);
|
||||||
@@ -283,7 +278,6 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
|
|||||||
postError(callback, packageName, ArtManager.SNAPSHOT_FAILED_INTERNAL_ERROR);
|
postError(callback, packageName, ArtManager.SNAPSHOT_FAILED_INTERNAL_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Open the snapshot and invoke the callback.
|
// Open the snapshot and invoke the callback.
|
||||||
File snapshotProfile = ArtManager.getProfileSnapshotFileForName(packageName, profileName);
|
File snapshotProfile = ArtManager.getProfileSnapshotFileForName(packageName, profileName);
|
||||||
@@ -308,13 +302,11 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
|
|||||||
Slog.d(TAG, "Destroying profile snapshot for" + packageName + ":" + profileName);
|
Slog.d(TAG, "Destroying profile snapshot for" + packageName + ":" + profileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (mInstallLock) {
|
|
||||||
try {
|
try {
|
||||||
mInstaller.destroyProfileSnapshot(packageName, profileName);
|
mInstaller.destroyProfileSnapshot(packageName, profileName);
|
||||||
} catch (InstallerException e) {
|
} catch (InstallerException e) {
|
||||||
Slog.e(TAG, "Failed to destroy profile snapshot for " +
|
Slog.e(TAG, "Failed to destroy profile snapshot for " + packageName + ":" + profileName,
|
||||||
packageName + ":" + profileName, e);
|
e);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,10 +472,8 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
|
|||||||
for (int i = packageProfileNames.size() - 1; i >= 0; i--) {
|
for (int i = packageProfileNames.size() - 1; i >= 0; i--) {
|
||||||
String codePath = packageProfileNames.keyAt(i);
|
String codePath = packageProfileNames.keyAt(i);
|
||||||
String profileName = packageProfileNames.valueAt(i);
|
String profileName = packageProfileNames.valueAt(i);
|
||||||
synchronized (mInstallLock) {
|
|
||||||
mInstaller.dumpProfiles(sharedGid, pkg.getPackageName(), profileName, codePath);
|
mInstaller.dumpProfiles(sharedGid, pkg.getPackageName(), profileName, codePath);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (InstallerException e) {
|
} catch (InstallerException e) {
|
||||||
Slog.w(TAG, "Failed to dump profiles", e);
|
Slog.w(TAG, "Failed to dump profiles", e);
|
||||||
}
|
}
|
||||||
@@ -512,10 +502,8 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
|
|||||||
") to " + outDexFile);
|
") to " + outDexFile);
|
||||||
final long callingId = Binder.clearCallingIdentity();
|
final long callingId = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
synchronized (mInstallLock) {
|
|
||||||
return mInstaller.compileLayouts(apkPath, packageName, outDexFile,
|
return mInstaller.compileLayouts(apkPath, packageName, outDexFile,
|
||||||
pkg.getUid());
|
pkg.getUid());
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
Binder.restoreCallingIdentity(callingId);
|
Binder.restoreCallingIdentity(callingId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user