mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Merge "Tracing for another "Launcher didn't initialize" failure" into ub-launcher3-master
This commit is contained in:
committed by
Android (Google) Code Review
commit
89321dde65
@@ -111,6 +111,11 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
|
||||
|
||||
@Override
|
||||
protected boolean isLauncherInitialized() {
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.LAUNCHER_DIDNT_INITIALIZE,
|
||||
"isLauncherInitialized.TouchInteractionService.isInitialized=" +
|
||||
TouchInteractionService.isInitialized());
|
||||
}
|
||||
return super.isLauncherInitialized() && TouchInteractionService.isInitialized();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,6 +135,9 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
TouchInteractionService.this.initInputMonitor();
|
||||
preloadOverview(true /* fromInit */);
|
||||
});
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.LAUNCHER_DIDNT_INITIALIZE, "TIS initialized");
|
||||
}
|
||||
sIsInitialized = true;
|
||||
}
|
||||
|
||||
@@ -392,6 +395,9 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.LAUNCHER_DIDNT_INITIALIZE, "TIS destroyed");
|
||||
}
|
||||
sIsInitialized = false;
|
||||
if (mDeviceState.isUserUnlocked()) {
|
||||
mInputConsumer.unregisterInputConsumer();
|
||||
|
||||
@@ -56,6 +56,7 @@ import com.android.launcher3.pm.InstallSessionTracker;
|
||||
import com.android.launcher3.pm.PackageInstallInfo;
|
||||
import com.android.launcher3.pm.UserCache;
|
||||
import com.android.launcher3.shortcuts.ShortcutRequest;
|
||||
import com.android.launcher3.testing.TestProtocol;
|
||||
import com.android.launcher3.util.IntSparseArrayMap;
|
||||
import com.android.launcher3.util.ItemInfoMatcher;
|
||||
import com.android.launcher3.util.LooperExecutor;
|
||||
@@ -96,6 +97,10 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi
|
||||
private boolean mModelLoaded;
|
||||
public boolean isModelLoaded() {
|
||||
synchronized (mLock) {
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.LAUNCHER_DIDNT_INITIALIZE,
|
||||
"isModelLoaded: " + mModelLoaded + ", " + mLoaderTask);
|
||||
}
|
||||
return mModelLoaded && mLoaderTask == null;
|
||||
}
|
||||
}
|
||||
@@ -368,6 +373,9 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi
|
||||
public boolean stopLoader() {
|
||||
synchronized (mLock) {
|
||||
LoaderTask oldTask = mLoaderTask;
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.LAUNCHER_DIDNT_INITIALIZE, "LauncherModel.stopLoader");
|
||||
}
|
||||
mLoaderTask = null;
|
||||
if (oldTask != null) {
|
||||
oldTask.stopLocked();
|
||||
@@ -381,6 +389,10 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi
|
||||
synchronized (mLock) {
|
||||
stopLoader();
|
||||
mLoaderTask = new LoaderTask(mApp, mBgAllAppsList, mBgDataModel, results);
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.LAUNCHER_DIDNT_INITIALIZE,
|
||||
"LauncherModel.startLoaderForResults " + mLoaderTask);
|
||||
}
|
||||
|
||||
// Always post the loader task, instead of running directly (even on same thread) so
|
||||
// that we exit any nested synchronized blocks
|
||||
@@ -482,6 +494,10 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi
|
||||
public void close() {
|
||||
synchronized (mLock) {
|
||||
// If we are still the last one to be scheduled, remove ourselves.
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.LAUNCHER_DIDNT_INITIALIZE,
|
||||
"LauncherModel.close " + mLoaderTask + ", " + mTask);
|
||||
}
|
||||
if (mLoaderTask == mTask) {
|
||||
mLoaderTask = null;
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ import com.android.launcher3.qsb.QsbContainerView;
|
||||
import com.android.launcher3.shortcuts.ShortcutKey;
|
||||
import com.android.launcher3.shortcuts.ShortcutRequest;
|
||||
import com.android.launcher3.shortcuts.ShortcutRequest.QueryResult;
|
||||
import com.android.launcher3.testing.TestProtocol;
|
||||
import com.android.launcher3.util.ComponentKey;
|
||||
import com.android.launcher3.util.IOUtils;
|
||||
import com.android.launcher3.util.LooperIdleLock;
|
||||
@@ -169,15 +170,32 @@ public class LoaderTask implements Runnable {
|
||||
}
|
||||
|
||||
public void run() {
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.LAUNCHER_DIDNT_INITIALIZE,
|
||||
"LoaderTask1 " + this);
|
||||
}
|
||||
synchronized (this) {
|
||||
// Skip fast if we are already stopped.
|
||||
if (mStopped) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.LAUNCHER_DIDNT_INITIALIZE,
|
||||
"LoaderTask2 " + this);
|
||||
}
|
||||
|
||||
Object traceToken = TraceHelper.INSTANCE.beginSection(TAG);
|
||||
TimingLogger logger = new TimingLogger(TAG, "run");
|
||||
TimingLogger logger = TestProtocol.sDebugTracing ?
|
||||
new TimingLogger(TAG, "run") {
|
||||
@Override
|
||||
public void addSplit(String splitLabel) {
|
||||
super.addSplit(splitLabel);
|
||||
Log.d(TestProtocol.LAUNCHER_DIDNT_INITIALIZE,
|
||||
"LoaderTask.addSplit " + splitLabel);
|
||||
}
|
||||
}
|
||||
: new TimingLogger(TAG, "run");
|
||||
try (LauncherModel.LoaderTransaction transaction = mApp.getModel().beginLoader(this)) {
|
||||
List<ShortcutInfo> allShortcuts = new ArrayList<>();
|
||||
loadWorkspace(allShortcuts);
|
||||
@@ -266,6 +284,10 @@ public class LoaderTask implements Runnable {
|
||||
updateHandler.finish();
|
||||
logger.addSplit("finish icon update");
|
||||
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.LAUNCHER_DIDNT_INITIALIZE,
|
||||
"LoaderTask3 " + this);
|
||||
}
|
||||
transaction.commit();
|
||||
} catch (CancellationException e) {
|
||||
// Loader stopped, ignore
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Debug;
|
||||
import android.system.Os;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
@@ -190,6 +191,11 @@ public class TestInformationHandler implements ResourceBasedOverride {
|
||||
}
|
||||
|
||||
protected boolean isLauncherInitialized() {
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.LAUNCHER_DIDNT_INITIALIZE,
|
||||
"isLauncherInitialized " + Launcher.ACTIVITY_TRACKER.getCreatedActivity() + ", "
|
||||
+ LauncherAppState.getInstance(mContext).getModel().isModelLoaded());
|
||||
}
|
||||
return Launcher.ACTIVITY_TRACKER.getCreatedActivity() == null
|
||||
|| LauncherAppState.getInstance(mContext).getModel().isModelLoaded();
|
||||
}
|
||||
|
||||
@@ -92,4 +92,5 @@ public final class TestProtocol {
|
||||
|
||||
public static final String NO_BACKGROUND_TO_OVERVIEW_TAG = "b/138251824";
|
||||
public static final String APP_NOT_DISABLED = "b/139891609";
|
||||
public static final String LAUNCHER_DIDNT_INITIALIZE = "b/148313079";
|
||||
}
|
||||
|
||||
@@ -45,7 +45,13 @@ public final class ActivityTracker<T extends BaseActivity> implements Runnable {
|
||||
}
|
||||
|
||||
public void onActivityDestroyed(T activity) {
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.LAUNCHER_DIDNT_INITIALIZE, "onActivityDestroyed");
|
||||
}
|
||||
if (mCurrentActivity.get() == activity) {
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.LAUNCHER_DIDNT_INITIALIZE, "onActivityDestroyed: clear");
|
||||
}
|
||||
mCurrentActivity.clear();
|
||||
}
|
||||
}
|
||||
@@ -110,6 +116,10 @@ public final class ActivityTracker<T extends BaseActivity> implements Runnable {
|
||||
}
|
||||
|
||||
public boolean handleCreate(T activity) {
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.LAUNCHER_DIDNT_INITIALIZE,
|
||||
"ActivityTracker.handleCreate " + mCurrentActivity.get() + " => " + activity);
|
||||
}
|
||||
mCurrentActivity = new WeakReference<>(activity);
|
||||
return handleIntent(activity, activity.getIntent(), false, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user