Move "mVold.onSecureKeyguardStateChanged" to handler thread
When insert a U disk or sdcard, if fsck or mount takes a long time, it will take several seconds for the screen to light up because the lock of vold process cannot be obtained, so we move the time-consuming method into the handler thread and use the new and old values of mSecureKeyguardShowing to determine whether a binder call is required. Test: Manual test Bug: 259900790 Change-Id: Ie0285d95c49bf37504ccc2821b856774d04806f7 Signed-off-by: zhuning3 <zhuning3@xiaomi.corp-partner.google.com>
This commit is contained in:
@@ -734,6 +734,7 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
private static final int H_COMPLETE_UNLOCK_USER = 14;
|
||||
private static final int H_VOLUME_STATE_CHANGED = 15;
|
||||
private static final int H_CLOUD_MEDIA_PROVIDER_CHANGED = 16;
|
||||
private static final int H_SECURE_KEYGUARD_STATE_CHANGED = 17;
|
||||
|
||||
class StorageManagerServiceHandler extends Handler {
|
||||
public StorageManagerServiceHandler(Looper looper) {
|
||||
@@ -873,6 +874,14 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
}
|
||||
break;
|
||||
}
|
||||
case H_SECURE_KEYGUARD_STATE_CHANGED: {
|
||||
try {
|
||||
mVold.onSecureKeyguardStateChanged((boolean) msg.obj);
|
||||
} catch (Exception e) {
|
||||
Slog.wtf(TAG, e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1332,12 +1341,12 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
public void onKeyguardStateChanged(boolean isShowing) {
|
||||
// Push down current secure keyguard status so that we ignore malicious
|
||||
// USB devices while locked.
|
||||
mSecureKeyguardShowing = isShowing
|
||||
boolean isSecureKeyguardShowing = isShowing
|
||||
&& mContext.getSystemService(KeyguardManager.class).isDeviceSecure(mCurrentUserId);
|
||||
try {
|
||||
mVold.onSecureKeyguardStateChanged(mSecureKeyguardShowing);
|
||||
} catch (Exception e) {
|
||||
Slog.wtf(TAG, e);
|
||||
if (mSecureKeyguardShowing != isSecureKeyguardShowing) {
|
||||
mSecureKeyguardShowing = isSecureKeyguardShowing;
|
||||
mHandler.obtainMessage(H_SECURE_KEYGUARD_STATE_CHANGED, mSecureKeyguardShowing)
|
||||
.sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user