Setup AnrController for StorageManagerService
If transcoding is enabled, the StorageManagerService configures an AnrController to allow delaying the ANR dialog when apps are transcoding. In later cl, the actual delay will be delegated to the ExternalStorageService (MediaProvider). Test: Manual Bug: 170486601 Change-Id: Iafefba6a24cca1da7a73c5364f34893bf1868bea
This commit is contained in:
@@ -890,7 +890,7 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
ZramWriteback.scheduleZramWriteback(mContext);
|
||||
}
|
||||
|
||||
updateTranscodeEnabled();
|
||||
configureTranscoding();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -922,7 +922,7 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTranscodeEnabled() {
|
||||
private void configureTranscoding() {
|
||||
// See MediaProvider TranscodeHelper#getBooleanProperty for more information
|
||||
boolean transcodeEnabled = false;
|
||||
boolean defaultValue = true;
|
||||
@@ -935,6 +935,15 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
"transcode_enabled", defaultValue);
|
||||
}
|
||||
SystemProperties.set("sys.fuse.transcode_enabled", String.valueOf(transcodeEnabled));
|
||||
|
||||
if (transcodeEnabled) {
|
||||
LocalServices.getService(ActivityManagerInternal.class)
|
||||
.registerAnrController((packageName, uid) -> {
|
||||
// TODO: Retrieve delay from ExternalStorageService that can check
|
||||
// transcoding status
|
||||
return SystemProperties.getInt("sys.fuse.transcode_anr_delay_ms", 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user