diff options
author | Jon Miranda <jonmiranda@google.com> | 2017-03-22 10:25:17 -0700 |
---|---|---|
committer | Jon Miranda <jonmiranda@google.com> | 2017-03-22 13:08:50 -0700 |
commit | fe96432b43c456ee51da1abe3a2d5b87938ac567 (patch) | |
tree | b0d30f2e55fbdba5a8fcf5a4bbaae64ef1a38678 /src | |
parent | 77ff9a4343aa40f0d893a9b65ecfbe4bf89e65e7 (diff) | |
download | packages_apps_Trebuchet-fe96432b43c456ee51da1abe3a2d5b87938ac567.tar.gz packages_apps_Trebuchet-fe96432b43c456ee51da1abe3a2d5b87938ac567.tar.bz2 packages_apps_Trebuchet-fe96432b43c456ee51da1abe3a2d5b87938ac567.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/BaseActivity.java | 7 | ||||
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/logging/UserEventDispatcher.java | 20 |
3 files changed, 15 insertions, 14 deletions
diff --git a/src/com/android/launcher3/BaseActivity.java b/src/com/android/launcher3/BaseActivity.java index e1a3ad0d6..410d590ad 100644 --- a/src/com/android/launcher3/BaseActivity.java +++ b/src/com/android/launcher3/BaseActivity.java @@ -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; diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 2dba83df6..660037e0e 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -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); diff --git a/src/com/android/launcher3/logging/UserEventDispatcher.java b/src/com/android/launcher3/logging/UserEventDispatcher.java index 90e453117..07e99c693 100644 --- a/src/com/android/launcher3/logging/UserEventDispatcher.java +++ b/src/com/android/launcher3/logging/UserEventDispatcher.java @@ -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, - context.getApplicationContext(), R.string.user_event_dispatcher_class); - } - return sInstance; - } + public static UserEventDispatcher newInstance(Context context, boolean isInMultiWindowMode) { + UserEventDispatcher ued = Utilities.getOverrideObject(UserEventDispatcher.class, + context.getApplicationContext(), R.string.user_event_dispatcher_class); + 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); } |