Remove device profile dependency from UserEventDispatcher
Bug: 110122682 Change-Id: I31ba61e60e31f1cc84e6d0cf115193e45d9fcfdb
This commit is contained in:
parent
17b7d36594
commit
956ec4b0e5
|
@ -184,8 +184,8 @@ message LauncherEvent {
|
|||
optional int64 elapsed_container_millis = 5;
|
||||
optional int64 elapsed_session_millis = 6;
|
||||
|
||||
optional bool is_in_multi_window_mode = 7;
|
||||
optional bool is_in_landscape_mode = 8;
|
||||
optional bool is_in_multi_window_mode = 7 [deprecated = true];
|
||||
optional bool is_in_landscape_mode = 8 [deprecated = true];
|
||||
|
||||
optional LauncherEventExtension extension = 9;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ import android.view.ViewConfiguration;
|
|||
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.BaseDraggingActivity;
|
||||
import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.MainThreadExecutor;
|
||||
import com.android.launcher3.anim.AnimationSuccessListener;
|
||||
import com.android.launcher3.logging.UserEventDispatcher;
|
||||
|
@ -198,9 +197,7 @@ public class OverviewCommandHelper {
|
|||
|
||||
public void onTip(int actionType, int viewType) {
|
||||
mMainThreadExecutor.execute(() ->
|
||||
UserEventDispatcher.newInstance(mContext,
|
||||
InvariantDeviceProfile.INSTANCE.get(mContext).getDeviceProfile(mContext))
|
||||
.logActionTip(actionType, viewType));
|
||||
UserEventDispatcher.newInstance(mContext).logActionTip(actionType, viewType));
|
||||
}
|
||||
|
||||
public ActivityControlHelper getActivityControlHelper() {
|
||||
|
|
|
@ -754,7 +754,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
|||
}
|
||||
|
||||
int dstContainerType = toLauncher ? ContainerType.TASKSWITCHER : ContainerType.APP;
|
||||
UserEventDispatcher.newInstance(mContext, dp).logStateChangeAction(
|
||||
UserEventDispatcher.newInstance(mContext).logStateChangeAction(
|
||||
mLogAction, direction,
|
||||
ContainerType.NAVBAR, ContainerType.APP,
|
||||
dstContainerType,
|
||||
|
|
|
@ -107,7 +107,7 @@ public abstract class BaseActivity extends Activity implements UserEventDelegate
|
|||
|
||||
public final UserEventDispatcher getUserEventDispatcher() {
|
||||
if (mUserEventDispatcher == null) {
|
||||
mUserEventDispatcher = UserEventDispatcher.newInstance(this, mDeviceProfile, this);
|
||||
mUserEventDispatcher = UserEventDispatcher.newInstance(this, this);
|
||||
}
|
||||
return mUserEventDispatcher;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ import android.util.Log;
|
|||
import android.view.View;
|
||||
import android.view.ViewParent;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.DropTarget;
|
||||
import com.android.launcher3.ItemInfo;
|
||||
import com.android.launcher3.R;
|
||||
|
@ -71,7 +70,7 @@ public class UserEventDispatcher implements ResourceBasedOverride {
|
|||
FeatureFlags.IS_DOGFOOD_BUILD && Utilities.isPropertyEnabled(LogConfig.USEREVENT);
|
||||
private static final String UUID_STORAGE = "uuid";
|
||||
|
||||
public static UserEventDispatcher newInstance(Context context, DeviceProfile dp,
|
||||
public static UserEventDispatcher newInstance(Context context,
|
||||
UserEventDelegate delegate) {
|
||||
SharedPreferences sharedPrefs = Utilities.getDevicePrefs(context);
|
||||
String uuidStr = sharedPrefs.getString(UUID_STORAGE, null);
|
||||
|
@ -82,15 +81,13 @@ public class UserEventDispatcher implements ResourceBasedOverride {
|
|||
UserEventDispatcher ued = Overrides.getObject(UserEventDispatcher.class,
|
||||
context.getApplicationContext(), R.string.user_event_dispatcher_class);
|
||||
ued.mDelegate = delegate;
|
||||
ued.mIsInLandscapeMode = dp.isVerticalBarLayout();
|
||||
ued.mIsInMultiWindowMode = dp.isMultiWindowMode;
|
||||
ued.mUuidStr = uuidStr;
|
||||
ued.mInstantAppResolver = InstantAppResolver.newInstance(context);
|
||||
return ued;
|
||||
}
|
||||
|
||||
public static UserEventDispatcher newInstance(Context context, DeviceProfile dp) {
|
||||
return newInstance(context, dp, null);
|
||||
public static UserEventDispatcher newInstance(Context context) {
|
||||
return newInstance(context, null);
|
||||
}
|
||||
|
||||
public interface UserEventDelegate {
|
||||
|
@ -140,8 +137,6 @@ public class UserEventDispatcher implements ResourceBasedOverride {
|
|||
private long mElapsedContainerMillis;
|
||||
private long mElapsedSessionMillis;
|
||||
private long mActionDurationMillis;
|
||||
private boolean mIsInMultiWindowMode;
|
||||
private boolean mIsInLandscapeMode;
|
||||
private String mUuidStr;
|
||||
protected InstantAppResolver mInstantAppResolver;
|
||||
private boolean mAppOrTaskLaunch;
|
||||
|
@ -435,8 +430,6 @@ public class UserEventDispatcher implements ResourceBasedOverride {
|
|||
|
||||
public void dispatchUserEvent(LauncherEvent ev, Intent intent) {
|
||||
mAppOrTaskLaunch = false;
|
||||
ev.isInLandscapeMode = mIsInLandscapeMode;
|
||||
ev.isInMultiWindowMode = mIsInMultiWindowMode;
|
||||
ev.elapsedContainerMillis = SystemClock.uptimeMillis() - mElapsedContainerMillis;
|
||||
ev.elapsedSessionMillis = SystemClock.uptimeMillis() - mElapsedSessionMillis;
|
||||
|
||||
|
@ -456,8 +449,6 @@ public class UserEventDispatcher implements ResourceBasedOverride {
|
|||
ev.elapsedContainerMillis,
|
||||
ev.elapsedSessionMillis,
|
||||
ev.actionDurationMillis);
|
||||
log += "\n isInLandscapeMode " + ev.isInLandscapeMode;
|
||||
log += "\n isInMultiWindowMode " + ev.isInMultiWindowMode;
|
||||
log += "\n\n";
|
||||
Log.d(TAG, log);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue