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

Commit 441c628a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Log whether an event happened during landscape mode or not b/38211234"...

Merge "Log whether an event happened during landscape mode or not b/38211234" into ub-launcher3-dorval
parents e7539e9b d5a9b577
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -156,4 +156,5 @@ message LauncherEvent {
  optional int64 elapsed_session_millis = 6;

  optional bool is_in_multi_window_mode = 7;
  optional bool is_in_landscape_mode = 8;
}
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ public abstract class BaseActivity extends Activity {
    public final UserEventDispatcher getUserEventDispatcher() {
        if (mUserEventDispatcher == null) {
            mUserEventDispatcher = UserEventDispatcher.newInstance(this,
                    isInMultiWindowModeCompat());
                    mDeviceProfile.isLandscape, isInMultiWindowModeCompat());
        }
        return mUserEventDispatcher;
    }
+6 −1
Original line number Diff line number Diff line
@@ -62,9 +62,11 @@ public class UserEventDispatcher {
    private static final boolean IS_VERBOSE =
            ProviderConfig.IS_DOGFOOD_BUILD && Utilities.isPropertyEnabled(LogConfig.USEREVENT);

    public static UserEventDispatcher newInstance(Context context, boolean isInMultiWindowMode) {
    public static UserEventDispatcher newInstance(Context context, boolean isInLandscapeMode,
            boolean isInMultiWindowMode) {
        UserEventDispatcher ued = Utilities.getOverrideObject(UserEventDispatcher.class,
                context.getApplicationContext(), R.string.user_event_dispatcher_class);
        ued.mIsInLandscapeMode = isInLandscapeMode;
        ued.mIsInMultiWindowMode = isInMultiWindowMode;
        return ued;
    }
@@ -112,6 +114,7 @@ public class UserEventDispatcher {
    private long mElapsedSessionMillis;
    private long mActionDurationMillis;
    private boolean mIsInMultiWindowMode;
    private boolean mIsInLandscapeMode;

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

    public void dispatchUserEvent(LauncherEvent ev, Intent intent) {
        ev.isInLandscapeMode = mIsInLandscapeMode;
        ev.isInMultiWindowMode = mIsInMultiWindowMode;
        ev.elapsedContainerMillis = SystemClock.uptimeMillis() - mElapsedContainerMillis;
        ev.elapsedSessionMillis = SystemClock.uptimeMillis() - mElapsedSessionMillis;
@@ -315,6 +319,7 @@ public class UserEventDispatcher {
                ev.elapsedContainerMillis,
                ev.elapsedSessionMillis,
                ev.actionDurationMillis);
        log += "\n isInLandscapeMode " + ev.isInLandscapeMode;
        log += "\n isInMultiWindowMode " + ev.isInMultiWindowMode;
        Log.d(TAG, log);
    }