Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce9134c9 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge changes I69baed7b,I38a1da16 into sc-dev

* changes:
  Logging config changes as well
  Reduce some logging from previous CL
parents e1ce26e7 dc0f3978
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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();
+9 −0
Original line number Diff line number Diff line
@@ -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);