Making LauncherProvider think that clear-db request comes from Launcher
If it comes from the test process, the request won't be honored. Bug: 159728364 Change-Id: I90029c1198634f1f1e94f61ba8ab9b41609d9ad5
This commit is contained in:
parent
b1e003c1fb
commit
efa3acddba
|
@ -23,6 +23,7 @@ import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.os.Binder;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Debug;
|
import android.os.Debug;
|
||||||
import android.system.Os;
|
import android.system.Os;
|
||||||
|
@ -171,11 +172,16 @@ public class DebugTestInformationHandler extends TestInformationHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
case TestProtocol.REQUEST_CLEAR_DATA: {
|
case TestProtocol.REQUEST_CLEAR_DATA: {
|
||||||
LauncherSettings.Settings.call(mContext.getContentResolver(),
|
final long identity = Binder.clearCallingIdentity();
|
||||||
LauncherSettings.Settings.METHOD_CREATE_EMPTY_DB);
|
try {
|
||||||
MAIN_EXECUTOR.submit(() ->
|
LauncherSettings.Settings.call(mContext.getContentResolver(),
|
||||||
LauncherAppState.getInstance(mContext).getModel().forceReload());
|
LauncherSettings.Settings.METHOD_CREATE_EMPTY_DB);
|
||||||
return response;
|
MAIN_EXECUTOR.submit(() ->
|
||||||
|
LauncherAppState.getInstance(mContext).getModel().forceReload());
|
||||||
|
return response;
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(identity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue