Merge "Merge RQ1A.210205.004 to aosp-master - DO NOT MERGE"
This commit is contained in:
@@ -1210,25 +1210,6 @@ public class ResolverActivity extends Activity implements
|
||||
if (TextUtils.isEmpty(packageName)) {
|
||||
pm.setDefaultBrowserPackageNameAsUser(ri.activityInfo.packageName, userId);
|
||||
}
|
||||
} else {
|
||||
// Update Domain Verification status
|
||||
ComponentName cn = intent.getComponent();
|
||||
String packageName = cn.getPackageName();
|
||||
String dataScheme = (data != null) ? data.getScheme() : null;
|
||||
|
||||
boolean isHttpOrHttps = (dataScheme != null) &&
|
||||
(dataScheme.equals(IntentFilter.SCHEME_HTTP) ||
|
||||
dataScheme.equals(IntentFilter.SCHEME_HTTPS));
|
||||
|
||||
boolean isViewAction = (action != null) && action.equals(Intent.ACTION_VIEW);
|
||||
boolean hasCategoryBrowsable = (categories != null) &&
|
||||
categories.contains(Intent.CATEGORY_BROWSABLE);
|
||||
|
||||
if (isHttpOrHttps && isViewAction && hasCategoryBrowsable) {
|
||||
pm.updateIntentVerificationStatusAsUser(packageName,
|
||||
PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS,
|
||||
userId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
|
||||
@@ -89,15 +89,7 @@ public class SystemSettingsValidators {
|
||||
return value == null || value.length() < MAX_LENGTH;
|
||||
}
|
||||
});
|
||||
VALIDATORS.put(
|
||||
System.FONT_SCALE,
|
||||
value -> {
|
||||
try {
|
||||
return Float.parseFloat(value) >= 0;
|
||||
} catch (NumberFormatException | NullPointerException e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
VALIDATORS.put(System.FONT_SCALE, new InclusiveFloatRangeValidator(0.85f, 1.3f));
|
||||
VALIDATORS.put(System.DIM_SCREEN, BOOLEAN_VALIDATOR);
|
||||
VALIDATORS.put(
|
||||
System.DISPLAY_COLOR_MODE,
|
||||
|
||||
@@ -7144,67 +7144,68 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
"getContentProviderImpl: after checkContentProviderPermission");
|
||||
|
||||
final long origId = Binder.clearCallingIdentity();
|
||||
try {
|
||||
checkTime(startTime, "getContentProviderImpl: incProviderCountLocked");
|
||||
|
||||
checkTime(startTime, "getContentProviderImpl: incProviderCountLocked");
|
||||
|
||||
// In this case the provider instance already exists, so we can
|
||||
// return it right away.
|
||||
conn = incProviderCountLocked(r, cpr, token, callingUid, callingPackage, callingTag,
|
||||
stable);
|
||||
if (conn != null && (conn.stableCount+conn.unstableCount) == 1) {
|
||||
if (cpr.proc != null
|
||||
&& r != null && r.setAdj <= ProcessList.PERCEPTIBLE_LOW_APP_ADJ) {
|
||||
// If this is a perceptible app accessing the provider,
|
||||
// make sure to count it as being accessed and thus
|
||||
// back up on the LRU list. This is good because
|
||||
// content providers are often expensive to start.
|
||||
checkTime(startTime, "getContentProviderImpl: before updateLruProcess");
|
||||
mProcessList.updateLruProcessLocked(cpr.proc, false, null);
|
||||
checkTime(startTime, "getContentProviderImpl: after updateLruProcess");
|
||||
// Return the provider instance right away since it already exists.
|
||||
conn = incProviderCountLocked(r, cpr, token, callingUid, callingPackage,
|
||||
callingTag, stable);
|
||||
if (conn != null && (conn.stableCount+conn.unstableCount) == 1) {
|
||||
if (cpr.proc != null
|
||||
&& r != null && r.setAdj <= ProcessList.PERCEPTIBLE_LOW_APP_ADJ) {
|
||||
// If this is a perceptible app accessing the provider,
|
||||
// make sure to count it as being accessed and thus
|
||||
// back up on the LRU list. This is good because
|
||||
// content providers are often expensive to start.
|
||||
checkTime(startTime, "getContentProviderImpl: before updateLruProcess");
|
||||
mProcessList.updateLruProcessLocked(cpr.proc, false, null);
|
||||
checkTime(startTime, "getContentProviderImpl: after updateLruProcess");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkTime(startTime, "getContentProviderImpl: before updateOomAdj");
|
||||
final int verifiedAdj = cpr.proc.verifiedAdj;
|
||||
boolean success = updateOomAdjLocked(cpr.proc, true,
|
||||
OomAdjuster.OOM_ADJ_REASON_GET_PROVIDER);
|
||||
// XXX things have changed so updateOomAdjLocked doesn't actually tell us
|
||||
// if the process has been successfully adjusted. So to reduce races with
|
||||
// it, we will check whether the process still exists. Note that this doesn't
|
||||
// completely get rid of races with LMK killing the process, but should make
|
||||
// them much smaller.
|
||||
if (success && verifiedAdj != cpr.proc.setAdj && !isProcessAliveLocked(cpr.proc)) {
|
||||
success = false;
|
||||
}
|
||||
maybeUpdateProviderUsageStatsLocked(r, cpr.info.packageName, name);
|
||||
checkTime(startTime, "getContentProviderImpl: after updateOomAdj");
|
||||
if (DEBUG_PROVIDER) Slog.i(TAG_PROVIDER, "Adjust success: " + success);
|
||||
// NOTE: there is still a race here where a signal could be
|
||||
// pending on the process even though we managed to update its
|
||||
// adj level. Not sure what to do about this, but at least
|
||||
// the race is now smaller.
|
||||
if (!success) {
|
||||
// Uh oh... it looks like the provider's process
|
||||
// has been killed on us. We need to wait for a new
|
||||
// process to be started, and make sure its death
|
||||
// doesn't kill our process.
|
||||
Slog.wtf(TAG, "Existing provider " + cpr.name.flattenToShortString()
|
||||
+ " is crashing; detaching " + r);
|
||||
boolean lastRef = decProviderCountLocked(conn, cpr, token, stable);
|
||||
if (!lastRef) {
|
||||
// This wasn't the last ref our process had on
|
||||
// the provider... we will be killed during cleaning up, bail.
|
||||
return null;
|
||||
checkTime(startTime, "getContentProviderImpl: before updateOomAdj");
|
||||
final int verifiedAdj = cpr.proc.verifiedAdj;
|
||||
boolean success = updateOomAdjLocked(cpr.proc, true,
|
||||
OomAdjuster.OOM_ADJ_REASON_GET_PROVIDER);
|
||||
// XXX things have changed so updateOomAdjLocked doesn't actually tell us
|
||||
// if the process has been successfully adjusted. So to reduce races with
|
||||
// it, we will check whether the process still exists. Note that this doesn't
|
||||
// completely get rid of races with LMK killing the process, but should make
|
||||
// them much smaller.
|
||||
if (success && verifiedAdj != cpr.proc.setAdj
|
||||
&& !isProcessAliveLocked(cpr.proc)) {
|
||||
success = false;
|
||||
}
|
||||
// We'll just start a new process to host the content provider
|
||||
providerRunning = false;
|
||||
conn = null;
|
||||
dyingProc = cpr.proc;
|
||||
} else {
|
||||
cpr.proc.verifiedAdj = cpr.proc.setAdj;
|
||||
maybeUpdateProviderUsageStatsLocked(r, cpr.info.packageName, name);
|
||||
checkTime(startTime, "getContentProviderImpl: after updateOomAdj");
|
||||
if (DEBUG_PROVIDER) Slog.i(TAG_PROVIDER, "Adjust success: " + success);
|
||||
// NOTE: there is still a race here where a signal could be
|
||||
// pending on the process even though we managed to update its
|
||||
// adj level. Not sure what to do about this, but at least
|
||||
// the race is now smaller.
|
||||
if (!success) {
|
||||
// Uh oh... it looks like the provider's process
|
||||
// has been killed on us. We need to wait for a new
|
||||
// process to be started, and make sure its death
|
||||
// doesn't kill our process.
|
||||
Slog.wtf(TAG, "Existing provider " + cpr.name.flattenToShortString()
|
||||
+ " is crashing; detaching " + r);
|
||||
boolean lastRef = decProviderCountLocked(conn, cpr, token, stable);
|
||||
if (!lastRef) {
|
||||
// This wasn't the last ref our process had on
|
||||
// the provider... we will be killed during cleaning up, bail.
|
||||
return null;
|
||||
}
|
||||
// We'll just start a new process to host the content provider
|
||||
providerRunning = false;
|
||||
conn = null;
|
||||
dyingProc = cpr.proc;
|
||||
} else {
|
||||
cpr.proc.verifiedAdj = cpr.proc.setAdj;
|
||||
}
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(origId);
|
||||
}
|
||||
|
||||
Binder.restoreCallingIdentity(origId);
|
||||
}
|
||||
|
||||
if (!providerRunning) {
|
||||
|
||||
@@ -299,6 +299,10 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
|
||||
final ArraySet<File> unclaimedStages = newArraySet(
|
||||
stagingDir.listFiles(sStageFilter));
|
||||
|
||||
// We also need to clean up orphaned staging directory for staged sessions
|
||||
final File stagedSessionStagingDir = Environment.getDataStagingDirectory(volumeUuid);
|
||||
unclaimedStages.addAll(newArraySet(stagedSessionStagingDir.listFiles()));
|
||||
|
||||
// Ignore stages claimed by active sessions
|
||||
for (int i = 0; i < mSessions.size(); i++) {
|
||||
final PackageInstallerSession session = mSessions.valueAt(i);
|
||||
|
||||
@@ -1598,6 +1598,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
destroyInternal();
|
||||
// Dispatch message to remove session from PackageInstallerService.
|
||||
dispatchSessionFinished(error, detailMessage, null);
|
||||
// TODO(b/173194203): clean up staged session in destroyInternal() call instead
|
||||
if (isStaged() && stageDir != null) {
|
||||
cleanStageDir();
|
||||
}
|
||||
}
|
||||
|
||||
private void onStorageUnhealthy() {
|
||||
|
||||
@@ -96,6 +96,19 @@ public class StagedInstallInternalTest {
|
||||
assertSessionReady(sessionId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStagedInstallationShouldCleanUpOnValidationFailure() throws Exception {
|
||||
InstallUtils.commitExpectingFailure(AssertionError.class, "INSTALL_FAILED_INVALID_APK",
|
||||
Install.single(TestApp.AIncompleteSplit).setStaged());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStagedInstallationShouldCleanUpOnValidationFailureMultiPackage()
|
||||
throws Exception {
|
||||
InstallUtils.commitExpectingFailure(AssertionError.class, "INSTALL_FAILED_INVALID_APK",
|
||||
Install.multi(TestApp.AIncompleteSplit, TestApp.B1, TestApp.Apex1).setStaged());
|
||||
}
|
||||
|
||||
private static void assertSessionReady(int sessionId) {
|
||||
assertSessionState(sessionId,
|
||||
(session) -> assertThat(session.isStagedSessionReady()).isTrue());
|
||||
|
||||
Reference in New Issue
Block a user