Merge "Add better logging around long launcher operations during unfold" into udc-qpr-dev

This commit is contained in:
Treehugger Robot
2023-08-07 17:25:05 +00:00
committed by Android (Google) Code Review
4 changed files with 59 additions and 36 deletions
@@ -40,6 +40,7 @@ import android.hardware.display.DisplayManager;
import android.net.Uri;
import android.os.Handler;
import android.os.SystemProperties;
import android.os.Trace;
import android.provider.Settings;
import android.util.Log;
import android.view.Display;
@@ -180,6 +181,8 @@ public class TaskbarManager {
@Override
public void onConfigurationChanged(Configuration newConfig) {
Trace.instantForTrack(Trace.TRACE_TAG_APP, "TaskbarManager",
"onConfigurationChanged: " + newConfig);
debugWhyTaskbarNotDestroyed(
"TaskbarManager#mComponentCallbacks.onConfigurationChanged: " + newConfig);
DeviceProfile dp = mUserUnlocked
@@ -347,38 +350,44 @@ public class TaskbarManager {
*/
@VisibleForTesting
public void recreateTaskbar() {
DeviceProfile dp = mUserUnlocked ?
Trace.beginSection("recreateTaskbar");
try {
DeviceProfile dp = mUserUnlocked ?
LauncherAppState.getIDP(mContext).getDeviceProfile(mContext) : null;
destroyExistingTaskbar();
destroyExistingTaskbar();
boolean isTaskbarEnabled = dp != null && isTaskbarPresent(dp);
debugWhyTaskbarNotDestroyed("recreateTaskbar: isTaskbarEnabled=" + isTaskbarEnabled
boolean isTaskbarEnabled = dp != null && isTaskbarPresent(dp);
debugWhyTaskbarNotDestroyed("recreateTaskbar: isTaskbarEnabled=" + isTaskbarEnabled
+ " [dp != null (i.e. mUserUnlocked)]=" + (dp != null)
+ " FLAG_HIDE_NAVBAR_WINDOW=" + FLAG_HIDE_NAVBAR_WINDOW
+ " dp.isTaskbarPresent=" + (dp == null ? "null" : dp.isTaskbarPresent));
if (!isTaskbarEnabled) {
SystemUiProxy.INSTANCE.get(mContext)
if (!isTaskbarEnabled) {
SystemUiProxy.INSTANCE.get(mContext)
.notifyTaskbarStatus(/* visible */ false, /* stashed */ false);
return;
}
return;
}
if (mTaskbarActivityContext == null) {
mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp, mNavButtonController,
if (mTaskbarActivityContext == null) {
mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp,
mNavButtonController,
mUnfoldProgressProvider);
} else {
mTaskbarActivityContext.updateDeviceProfile(dp);
}
mTaskbarActivityContext.init(mSharedState);
} else {
mTaskbarActivityContext.updateDeviceProfile(dp);
}
mTaskbarActivityContext.init(mSharedState);
if (mActivity != null) {
mTaskbarActivityContext.setUIController(
if (mActivity != null) {
mTaskbarActivityContext.setUIController(
createTaskbarUIControllerForActivity(mActivity));
}
}
// We to wait until user unlocks the device to attach listener.
LauncherPrefs.get(mContext).addListener(mTaskbarPinningPreferenceChangeListener,
// We to wait until user unlocks the device to attach listener.
LauncherPrefs.get(mContext).addListener(mTaskbarPinningPreferenceChangeListener,
TASKBAR_PINNING);
} finally {
Trace.endSection();
}
}
public void onSystemUiFlagsChanged(int systemUiStateFlags) {
+16 -11
View File
@@ -725,18 +725,23 @@ public class Launcher extends StatefulActivity<LauncherState>
@Override
protected void onHandleConfigurationChanged() {
if (!initDeviceProfile(mDeviceProfile.inv)) {
return;
Trace.beginSection("Launcher#onHandleconfigurationChanged");
try {
if (!initDeviceProfile(mDeviceProfile.inv)) {
return;
}
dispatchDeviceProfileChanged();
reapplyUi();
mDragLayer.recreateControllers();
// Calling onSaveInstanceState ensures that static cache used by listWidgets is
// initialized properly.
onSaveInstanceState(new Bundle());
mModel.rebindCallbacks();
} finally {
Trace.endSection();
}
dispatchDeviceProfileChanged();
reapplyUi();
mDragLayer.recreateControllers();
// Calling onSaveInstanceState ensures that static cache used by listWidgets is
// initialized properly.
onSaveInstanceState(new Bundle());
mModel.rebindCallbacks();
}
public void onAssistantVisibilityChanged(float visibility) {
@@ -28,6 +28,7 @@ import android.content.Context;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.os.Trace;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -182,6 +183,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
Trace.beginSection("ShortcutAndWidgetConteiner#onLayout");
int count = getChildCount();
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
@@ -189,6 +191,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.
layoutChild(child);
}
}
Trace.endSection();
}
/**
@@ -21,6 +21,7 @@ import static com.android.launcher3.model.ModelUtils.filterCurrentWorkspaceItems
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
import android.os.Process;
import android.os.Trace;
import android.util.Log;
import com.android.launcher3.InvariantDeviceProfile;
@@ -83,13 +84,18 @@ public abstract class BaseLauncherBinder {
* Binds all loaded data to actual views on the main thread.
*/
public void bindWorkspace(boolean incrementBindId, boolean isBindSync) {
if (FeatureFlags.ENABLE_WORKSPACE_LOADING_OPTIMIZATION.get()) {
DisjointWorkspaceBinder workspaceBinder =
Trace.beginSection("BaseLauncherBinder#bindWorkspace");
try {
if (FeatureFlags.ENABLE_WORKSPACE_LOADING_OPTIMIZATION.get()) {
DisjointWorkspaceBinder workspaceBinder =
initWorkspaceBinder(incrementBindId, mBgDataModel.collectWorkspaceScreens());
workspaceBinder.bindCurrentWorkspacePages(isBindSync);
workspaceBinder.bindOtherWorkspacePages();
} else {
bindWorkspaceAllAtOnce(incrementBindId, isBindSync);
workspaceBinder.bindCurrentWorkspacePages(isBindSync);
workspaceBinder.bindOtherWorkspacePages();
} else {
bindWorkspaceAllAtOnce(incrementBindId, isBindSync);
}
} finally {
Trace.endSection();
}
}