mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
Merge "Add isInMultiWindowMode bool to all logs." into ub-launcher3-dorval
This commit is contained in:
committed by
Android (Google) Code Review
commit
8eb0de1331
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user