From 3567f2be56a1b27548ba9048d3b945e9d03d8323 Mon Sep 17 00:00:00 2001 From: Sudheer Shanka Date: Thu, 7 May 2020 03:37:17 -0700 Subject: [PATCH] Skip registering callback for appop changes if fuse is enabled. The work done in StorageManagerService when opChanged() callback gets triggered is causing delay in sending onLockedBootCompleted() callback during the user switch. Given that opChanged() computes the mount mode but does not use it for anything, this change skips listening to these appop changes to speed up the user switch process. Bug: 134624284 Test: atest cts/hostsidetests/appsecurity/src/android/appsecurity/cts/ExternalStorageHostTest.java (Same P/F with and without this change) Change-Id: I4bbdfa7954ab0499e4828f4bff0b2ce80444471b --- .../com/android/server/StorageManagerService.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java index be539456ae7c1..43ed8538fb0cf 100644 --- a/services/core/java/com/android/server/StorageManagerService.java +++ b/services/core/java/com/android/server/StorageManagerService.java @@ -1941,10 +1941,13 @@ class StorageManagerService extends IStorageManager.Stub mDownloadsAuthorityAppId = UserHandle.getAppId(provider.applicationInfo.uid); } - try { - mIAppOpsService.startWatchingMode(OP_REQUEST_INSTALL_PACKAGES, null, mAppOpsCallback); - mIAppOpsService.startWatchingMode(OP_LEGACY_STORAGE, null, mAppOpsCallback); - } catch (RemoteException e) { + if (!mIsFuseEnabled) { + try { + mIAppOpsService.startWatchingMode(OP_REQUEST_INSTALL_PACKAGES, null, + mAppOpsCallback); + mIAppOpsService.startWatchingMode(OP_LEGACY_STORAGE, null, mAppOpsCallback); + } catch (RemoteException e) { + } } }