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

Commit fe96432b authored by Jon Miranda's avatar Jon Miranda
Browse files

Add isInMultiWindowMode bool to all logs.

Example output:
D/UserEvent: action:LONGPRESS
       Source child:WORKSPACE id=0
       Elapsed container 1850 ms session 1850 ms action 0 ms
       isInMultiWindowMode true

Bug: 34250955

Change-Id: If21484e8bbb0f4f311c2eb6e94b7dcea6d2431af
parent 77ff9a43
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -149,4 +149,6 @@ message LauncherEvent {
  optional int64 action_duration_millis = 4;
  optional int64 elapsed_container_millis = 5;
  optional int64 elapsed_session_millis = 6;

  optional bool is_in_multi_window_mode = 7;
}
+6 −1
Original line number Diff line number Diff line
@@ -38,11 +38,16 @@ public abstract class BaseActivity extends Activity {

    public final UserEventDispatcher getUserEventDispatcher() {
        if (mUserEventDispatcher == null) {
            mUserEventDispatcher = UserEventDispatcher.get(this);
            mUserEventDispatcher = UserEventDispatcher.newInstance(this,
                    isInMultiWindowModeCompat());
        }
        return mUserEventDispatcher;
    }

    public boolean isInMultiWindowModeCompat() {
        return Utilities.ATLEAST_NOUGAT && isInMultiWindowMode();
    }

    public static BaseActivity fromContext(Context context) {
        if (context instanceof BaseActivity) {
            return (BaseActivity) context;
+1 −1
Original line number Diff line number Diff line
@@ -366,7 +366,7 @@ public class Launcher extends BaseActivity

        // Load configuration-specific DeviceProfile
        mDeviceProfile = app.getInvariantDeviceProfile().getDeviceProfile(this);
        if (Utilities.ATLEAST_NOUGAT && isInMultiWindowMode()) {
        if (isInMultiWindowModeCompat()) {
            Display display = getWindowManager().getDefaultDisplay();
            Point mwSize = new Point();
            display.getSize(mwSize);
+8 −12
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import com.android.launcher3.ItemInfo;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent;
@@ -63,17 +62,11 @@ public class UserEventDispatcher {
    private static final boolean IS_VERBOSE =
            ProviderConfig.IS_DOGFOOD_BUILD && Utilities.isPropertyEnabled(LogConfig.USEREVENT);

    private static UserEventDispatcher sInstance;
    private static final Object LOCK = new Object();

    public static UserEventDispatcher get(Context context) {
        synchronized (LOCK) {
            if (sInstance == null) {
                sInstance = Utilities.getOverrideObject(UserEventDispatcher.class,
    public static UserEventDispatcher newInstance(Context context, boolean isInMultiWindowMode) {
        UserEventDispatcher ued = Utilities.getOverrideObject(UserEventDispatcher.class,
                context.getApplicationContext(), R.string.user_event_dispatcher_class);
            }
            return sInstance;
        }
        ued.mIsInMultiWindowMode = isInMultiWindowMode;
        return ued;
    }

    /**
@@ -118,6 +111,7 @@ public class UserEventDispatcher {
    private long mElapsedContainerMillis;
    private long mElapsedSessionMillis;
    private long mActionDurationMillis;
    private boolean mIsInMultiWindowMode;

    // Used for filling in predictedRank on {@link Target}s.
    private List<ComponentKey> mPredictedApps;
@@ -302,6 +296,7 @@ public class UserEventDispatcher {
    }

    public void dispatchUserEvent(LauncherEvent ev, Intent intent) {
        ev.isInMultiWindowMode = mIsInMultiWindowMode;
        ev.elapsedContainerMillis = SystemClock.uptimeMillis() - mElapsedContainerMillis;
        ev.elapsedSessionMillis = SystemClock.uptimeMillis() - mElapsedSessionMillis;

@@ -320,6 +315,7 @@ public class UserEventDispatcher {
                ev.elapsedContainerMillis,
                ev.elapsedSessionMillis,
                ev.actionDurationMillis);
        log += "\n isInMultiWindowMode " + ev.isInMultiWindowMode;
        Log.d(TAG, log);
    }