Merge "Add the jank detection to Settings sliders" into tm-dev
This commit is contained in:
@@ -18,6 +18,8 @@ package com.android.settings;
|
||||
|
||||
import static android.view.HapticFeedbackConstants.CLOCK_TICK;
|
||||
|
||||
import static com.android.internal.jank.InteractionJankMonitor.CUJ_SETTINGS_SLIDER;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.database.ContentObserver;
|
||||
@@ -30,9 +32,12 @@ import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
import com.android.internal.jank.InteractionJankMonitor;
|
||||
|
||||
public class PointerSpeedPreference extends SeekBarDialogPreference implements
|
||||
SeekBar.OnSeekBarChangeListener {
|
||||
private final InputManager mIm;
|
||||
private final InteractionJankMonitor mJankMonitor = InteractionJankMonitor.getInstance();
|
||||
private SeekBar mSeekBar;
|
||||
|
||||
private int mOldSpeed;
|
||||
@@ -88,11 +93,15 @@ public class PointerSpeedPreference extends SeekBarDialogPreference implements
|
||||
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
mTouchInProgress = true;
|
||||
mJankMonitor.begin(InteractionJankMonitor.Configuration.Builder
|
||||
.withView(CUJ_SETTINGS_SLIDER, seekBar)
|
||||
.setTag(getKey()));
|
||||
}
|
||||
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
mTouchInProgress = false;
|
||||
mIm.tryPointerSpeed(seekBar.getProgress() + InputManager.MIN_POINTER_SPEED);
|
||||
mJankMonitor.end(CUJ_SETTINGS_SLIDER);
|
||||
}
|
||||
|
||||
private void onSpeedChanged() {
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.notification;
|
||||
|
||||
import static com.android.internal.jank.InteractionJankMonitor.CUJ_SETTINGS_SLIDER;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.media.AudioManager;
|
||||
@@ -31,6 +33,7 @@ import android.widget.TextView;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import com.android.internal.jank.InteractionJankMonitor;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.widget.SeekBarPreference;
|
||||
|
||||
@@ -40,6 +43,8 @@ import java.util.Objects;
|
||||
public class VolumeSeekBarPreference extends SeekBarPreference {
|
||||
private static final String TAG = "VolumeSeekBarPreference";
|
||||
|
||||
private final InteractionJankMonitor mJankMonitor = InteractionJankMonitor.getInstance();
|
||||
|
||||
protected SeekBar mSeekBar;
|
||||
private int mStream;
|
||||
private SeekBarVolumizer mVolumizer;
|
||||
@@ -143,6 +148,13 @@ public class VolumeSeekBarPreference extends SeekBarPreference {
|
||||
if (mCallback != null) {
|
||||
mCallback.onStartTrackingTouch(sbv);
|
||||
}
|
||||
mJankMonitor.begin(InteractionJankMonitor.Configuration.Builder
|
||||
.withView(CUJ_SETTINGS_SLIDER, mSeekBar)
|
||||
.setTag(getKey()));
|
||||
}
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBarVolumizer sbv) {
|
||||
mJankMonitor.end(CUJ_SETTINGS_SLIDER);
|
||||
}
|
||||
};
|
||||
final Uri sampleUri = mStream == AudioManager.STREAM_MUSIC ? getMediaVolumeUri() : null;
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.android.settings.widget;
|
||||
|
||||
import static android.view.HapticFeedbackConstants.CLOCK_TICK;
|
||||
|
||||
import static com.android.internal.jank.InteractionJankMonitor.CUJ_SETTINGS_SLIDER;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Parcel;
|
||||
@@ -33,6 +35,7 @@ import android.widget.SeekBar.OnSeekBarChangeListener;
|
||||
import androidx.core.content.res.TypedArrayUtils;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import com.android.internal.jank.InteractionJankMonitor;
|
||||
import com.android.settingslib.RestrictedPreference;
|
||||
|
||||
/**
|
||||
@@ -45,6 +48,7 @@ public class SeekBarPreference extends RestrictedPreference
|
||||
public static final int HAPTIC_FEEDBACK_MODE_ON_TICKS = 1;
|
||||
public static final int HAPTIC_FEEDBACK_MODE_ON_ENDS = 2;
|
||||
|
||||
private final InteractionJankMonitor mJankMonitor = InteractionJankMonitor.getInstance();
|
||||
private int mProgress;
|
||||
private int mMax;
|
||||
private int mMin;
|
||||
@@ -312,6 +316,9 @@ public class SeekBarPreference extends RestrictedPreference
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
mTrackingTouch = true;
|
||||
mJankMonitor.begin(InteractionJankMonitor.Configuration.Builder
|
||||
.withView(CUJ_SETTINGS_SLIDER, seekBar)
|
||||
.setTag(getKey()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -320,6 +327,7 @@ public class SeekBarPreference extends RestrictedPreference
|
||||
if (seekBar.getProgress() != mProgress) {
|
||||
syncProgress(seekBar);
|
||||
}
|
||||
mJankMonitor.end(CUJ_SETTINGS_SLIDER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user