From 0bba6a79fcad8cbe46b8cd625c9d6cc56279e27e Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Tue, 20 Apr 2021 15:41:51 -0700 Subject: [PATCH 1/2] Reduce some logging from previous CL Bug: 185820525 Test: Presubmit Change-Id: I38a1da163eedf5f07bd507674ecb8661e8649d23 --- src/com/android/launcher3/InvariantDeviceProfile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index a863e6b55c..27e2995a28 100644 --- a/src/com/android/launcher3/InvariantDeviceProfile.java +++ b/src/com/android/launcher3/InvariantDeviceProfile.java @@ -578,7 +578,7 @@ public class InvariantDeviceProfile { public DeviceProfile getDeviceProfile(Context context) { if (TestProtocol.sDebugTracing) { Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "getDeviceProfile: orientation=" - + context.getResources().getConfiguration().orientation, new Throwable()); + + context.getResources().getConfiguration().orientation); } return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? landscapeProfile : portraitProfile; From dc0f3978e7e1541a57da609260c42528da260b81 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Tue, 20 Apr 2021 18:18:51 -0700 Subject: [PATCH 2/2] Logging config changes as well Reduce some logging from previous CL Bug: 185820525 Test: Presubmit Change-Id: I69baed7b819b529db30a65cb39a80fb310d76243 --- src/com/android/launcher3/InvariantDeviceProfile.java | 3 +++ src/com/android/launcher3/Launcher.java | 9 +++++++-- src/com/android/launcher3/util/ConfigMonitor.java | 9 +++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index 27e2995a28..61023be019 100644 --- a/src/com/android/launcher3/InvariantDeviceProfile.java +++ b/src/com/android/launcher3/InvariantDeviceProfile.java @@ -394,6 +394,9 @@ public class InvariantDeviceProfile { } private void onConfigChanged(Context context) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "IDP.onConfigChanged"); + } // Config changes, what shall we do? InvariantDeviceProfile oldProfile = new InvariantDeviceProfile(this); diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 30dd5481d2..a54c791aff 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -551,11 +551,16 @@ public class Launcher extends StatefulActivity implements Launche @Override public void onConfigurationChanged(Configuration newConfig) { int diff = newConfig.diff(mOldConfig); - if ((diff & (CONFIG_ORIENTATION | CONFIG_SCREEN_SIZE)) != 0) { onIdpChanged(mDeviceProfile.inv); } + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "onConfigurationChanged: diff=" + diff); + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "newConfig=" + newConfig); + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "oldConfig=" + mOldConfig); + } + mOldConfig.setTo(newConfig); super.onConfigurationChanged(newConfig); } @@ -567,7 +572,7 @@ public class Launcher extends StatefulActivity implements Launche private void onIdpChanged(InvariantDeviceProfile idp) { if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "onIdpChanged", new Throwable()); + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "onIdpChanged"); } initDeviceProfile(idp); dispatchDeviceProfileChanged(); diff --git a/src/com/android/launcher3/util/ConfigMonitor.java b/src/com/android/launcher3/util/ConfigMonitor.java index b3b69f6ab3..f7023e8f44 100644 --- a/src/com/android/launcher3/util/ConfigMonitor.java +++ b/src/com/android/launcher3/util/ConfigMonitor.java @@ -26,6 +26,7 @@ import android.content.res.Configuration; import android.graphics.Point; import android.util.Log; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.util.DisplayController.DisplayInfoChangeListener; import com.android.launcher3.util.DisplayController.Info; @@ -72,6 +73,10 @@ public class ConfigMonitor extends BroadcastReceiver implements DisplayInfoChang // Listen for configuration change mContext.registerReceiver(this, new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED)); + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "ConfigMonitor.register: this=" + + System.identityHashCode(this) + " callback=" + callback.getClass().getName()); + } } @Override @@ -113,6 +118,10 @@ public class ConfigMonitor extends BroadcastReceiver implements DisplayInfoChang } public void unregister() { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "ConfigMonitor.unregister: this=" + + System.identityHashCode(this)); + } try { mContext.unregisterReceiver(this); DisplayController.getDefaultDisplay(mContext).removeChangeListener(this);