Merge changes I69baed7b,I38a1da16 into sc-dev am: ce9134c982

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14257954

Change-Id: I76eb94bd8f69585a64804be0564ad143f93121ea
This commit is contained in:
Winson Chung
2021-04-21 04:08:20 +00:00
committed by Automerger Merge Worker
3 changed files with 20 additions and 3 deletions
@@ -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);
@@ -578,7 +581,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;
+7 -2
View File
@@ -551,11 +551,16 @@ public class Launcher extends StatefulActivity<LauncherState> 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<LauncherState> 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();
@@ -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);