mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 09:26:51 +00:00
Fixing test flakiness in Launcher initialization
Using same key for blob store and content provider based layouts Using a single key for layout provider. This ensures that if one test doesn't cleanup properly, any followup test which relies on model initialization overrides the key appropriately Bug: 370080120 Test: Presubmit Flag: EXEMPT bugfix Change-Id: Idef0a89a5d1ec89e24aae8a4549fd122634dad2f
This commit is contained in:
@@ -15,14 +15,12 @@
|
||||
*/
|
||||
package com.android.launcher3.util;
|
||||
|
||||
import static android.util.Base64.NO_PADDING;
|
||||
import static android.util.Base64.NO_WRAP;
|
||||
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
|
||||
import static com.android.launcher3.LauncherSettings.Settings.LAYOUT_DIGEST_KEY;
|
||||
import static com.android.launcher3.LauncherSettings.Settings.LAYOUT_DIGEST_LABEL;
|
||||
import static com.android.launcher3.LauncherSettings.Settings.LAYOUT_DIGEST_TAG;
|
||||
import static com.android.launcher3.LauncherSettings.Settings.LAYOUT_PROVIDER_KEY;
|
||||
import static com.android.launcher3.LauncherSettings.Settings.createBlobProviderKey;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@@ -42,7 +40,6 @@ import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.system.OsConstants;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.test.uiautomator.UiDevice;
|
||||
@@ -169,13 +166,12 @@ public class TestUtil {
|
||||
session.commit(AsyncTask.THREAD_POOL_EXECUTOR, i -> wait.countDown());
|
||||
}
|
||||
|
||||
String key = Base64.encodeToString(digest, NO_WRAP | NO_PADDING);
|
||||
|
||||
grantWriteSecurePermission();
|
||||
Settings.Secure.putString(context.getContentResolver(), LAYOUT_DIGEST_KEY, key);
|
||||
Settings.Secure.putString(
|
||||
context.getContentResolver(), LAYOUT_PROVIDER_KEY, createBlobProviderKey(digest));
|
||||
wait.await();
|
||||
return () ->
|
||||
Settings.Secure.putString(context.getContentResolver(), LAYOUT_DIGEST_KEY, null);
|
||||
Settings.Secure.putString(context.getContentResolver(), LAYOUT_PROVIDER_KEY, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user