Skip to content

Commit 438a0ef

Browse files
committed
Do not eject internal ASECs when storage unmounted
If the incoming request is to notify of storage unmounted, don't mess with apps that are in internal ASECs. Bug: 6948035 Change-Id: I63ffb895c4d994ee03a5a9bd6bb23f69c88e2a87
1 parent ea31b47 commit 438a0ef

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

services/java/com/android/server/pm/PackageManagerService.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8833,7 +8833,7 @@ public void updateExternalMediaStatus(final boolean mediaStatus, final boolean r
88338833
// little while.
88348834
mHandler.post(new Runnable() {
88358835
public void run() {
8836-
updateExternalMediaStatusInner(mediaStatus, reportStatus);
8836+
updateExternalMediaStatusInner(mediaStatus, reportStatus, true);
88378837
}
88388838
});
88398839
}
@@ -8843,7 +8843,7 @@ public void run() {
88438843
* Should block until all the ASEC containers are finished being scanned.
88448844
*/
88458845
public void scanAvailableAsecs() {
8846-
updateExternalMediaStatusInner(true, false);
8846+
updateExternalMediaStatusInner(true, false, false);
88478847
}
88488848

88498849
/*
@@ -8852,7 +8852,8 @@ public void scanAvailableAsecs() {
88528852
* Please note that we always have to report status if reportStatus has been
88538853
* set to true especially when unloading packages.
88548854
*/
8855-
private void updateExternalMediaStatusInner(boolean isMounted, boolean reportStatus) {
8855+
private void updateExternalMediaStatusInner(boolean isMounted, boolean reportStatus,
8856+
boolean externalStorage) {
88568857
// Collection of uids
88578858
int uidArr[] = null;
88588859
// Collection of stale containers
@@ -8890,6 +8891,14 @@ private void updateExternalMediaStatusInner(boolean isMounted, boolean reportSta
88908891
continue;
88918892
}
88928893

8894+
/*
8895+
* Skip packages that are not external if we're unmounting
8896+
* external storage.
8897+
*/
8898+
if (externalStorage && !isMounted && !isExternal(ps)) {
8899+
continue;
8900+
}
8901+
88938902
final AsecInstallArgs args = new AsecInstallArgs(cid, isForwardLocked(ps));
88948903
// The package status is changed only if the code path
88958904
// matches between settings and the container id.

0 commit comments

Comments
 (0)