summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/hardware/LegacySensorManager.java11
-rw-r--r--core/java/android/provider/Settings.java13
-rw-r--r--core/java/com/android/internal/policy/IFaceLockInterface.aidl1
-rw-r--r--core/java/com/android/internal/widget/LockPatternUtils.java24
-rw-r--r--core/java/com/android/internal/widget/multiwaveview/GlowPadView.java60
5 files changed, 81 insertions, 28 deletions
diff --git a/core/java/android/hardware/LegacySensorManager.java b/core/java/android/hardware/LegacySensorManager.java
index 62c194f..f959093 100644
--- a/core/java/android/hardware/LegacySensorManager.java
+++ b/core/java/android/hardware/LegacySensorManager.java
@@ -371,7 +371,7 @@ final class LegacySensorManager {
private static final float PREDICTION_RATIO = 1.0f/3.0f;
private static final float PREDICTION_TIME = (SENSORS_RATE_MS*COUNT/1000.0f)*PREDICTION_RATIO;
private float mV[] = new float[COUNT*2];
- private float mT[] = new float[COUNT*2];
+ private long mT[] = new long[COUNT*2];
private int mIndex;
public LmsFilter() {
@@ -381,7 +381,6 @@ final class LegacySensorManager {
public float filter(long time, float in) {
float v = in;
final float ns = 1.0f / 1000000000.0f;
- final float t = time*ns;
float v1 = mV[mIndex];
if ((v-v1) > 180) {
v -= 360;
@@ -396,9 +395,9 @@ final class LegacySensorManager {
if (mIndex >= COUNT*2)
mIndex = COUNT;
mV[mIndex] = v;
- mT[mIndex] = t;
+ mT[mIndex] = time;
mV[mIndex-COUNT] = v;
- mT[mIndex-COUNT] = t;
+ mT[mIndex-COUNT] = time;
float A, B, C, D, E;
float a, b;
@@ -408,8 +407,8 @@ final class LegacySensorManager {
for (i=0 ; i<COUNT-1 ; i++) {
final int j = mIndex - 1 - i;
final float Z = mV[j];
- final float T = 0.5f*(mT[j] + mT[j+1]) - t;
- float dT = mT[j] - mT[j+1];
+ final float T = (mT[j]/2 + mT[j+1]/2 - time)*ns;
+ float dT = (mT[j] - mT[j+1])*ns;
dT *= dT;
A += Z*dT;
B += T*(T*dT);
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 23c12f6..f482335 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -3216,20 +3216,27 @@ public final class Settings {
/**
- * This preference contains the string that shows for owner info on LockScren.
+ * This preference contains the string that shows for owner info on LockScreen.
* @hide
*/
public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info";
/**
- * Id of the user-selected appwidget on the lockscreen, or -1 if none
+ * Ids of the user-selected appwidgets on the lockscreen (comma-delimited).
* @hide
*/
public static final String LOCK_SCREEN_APPWIDGET_IDS =
"lock_screen_appwidget_ids";
/**
- * This preference enables showing the owner info on LockScren.
+ * Index of the lockscreen appwidget to restore, -1 if none.
+ * @hide
+ */
+ public static final String LOCK_SCREEN_STICKY_APPWIDGET =
+ "lock_screen_sticky_appwidget";
+
+ /**
+ * This preference enables showing the owner info on LockScreen.
* @hide
*/
public static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
diff --git a/core/java/com/android/internal/policy/IFaceLockInterface.aidl b/core/java/com/android/internal/policy/IFaceLockInterface.aidl
index 017801b..a017722 100644
--- a/core/java/com/android/internal/policy/IFaceLockInterface.aidl
+++ b/core/java/com/android/internal/policy/IFaceLockInterface.aidl
@@ -23,6 +23,7 @@ interface IFaceLockInterface {
void startUi(IBinder containingWindowToken, int x, int y, int width, int height,
boolean useLiveliness);
void stopUi();
+ void makeInvisible();
void registerCallback(IFaceLockCallback cb);
void unregisterCallback(IFaceLockCallback cb);
}
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index f6ae83c..f8c3b4d 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -150,7 +150,6 @@ public class LockPatternUtils {
private final ContentResolver mContentResolver;
private DevicePolicyManager mDevicePolicyManager;
private ILockSettings mLockSettingsService;
- private int mStickyWidgetIndex = -1;
// The current user is set by KeyguardViewMediator and shared by all LockPatternUtils.
private static volatile int sCurrentUserId = UserHandle.USER_NULL;
@@ -1162,6 +1161,21 @@ public class LockPatternUtils {
return true;
}
+ public int getStickyAppWidgetIndex() {
+ return Settings.Secure.getIntForUser(
+ mContentResolver,
+ Settings.Secure.LOCK_SCREEN_STICKY_APPWIDGET,
+ -1,
+ UserHandle.USER_CURRENT);
+ }
+
+ public void setStickyAppWidgetIndex(int value) {
+ Settings.Secure.putIntForUser(mContentResolver,
+ Settings.Secure.LOCK_SCREEN_STICKY_APPWIDGET,
+ value,
+ UserHandle.USER_CURRENT);
+ }
+
private long getLong(String secureSettingKey, long defaultValue) {
try {
return getLockSettings().getLong(secureSettingKey, defaultValue,
@@ -1311,12 +1325,4 @@ public class LockPatternUtils {
return getBoolean(LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS, true);
}
- public int getStickyWidgetIndex() {
- return mStickyWidgetIndex;
- }
-
- public void setStickyWidgetIndex(int stickyWidgetIndex) {
- mStickyWidgetIndex = stickyWidgetIndex;
- }
-
}
diff --git a/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java b/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
index b7f64ec..209bd3c 100644
--- a/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
+++ b/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
@@ -116,6 +116,8 @@ public class GlowPadView extends View {
private float mOuterRadius = 0.0f;
private float mSnapMargin = 0.0f;
+ private float mFirstItemOffset = 0.0f;
+ private boolean mMagneticTargets = false;
private boolean mDragging;
private int mNewTargetResources;
@@ -212,6 +214,9 @@ public class GlowPadView extends View {
mInnerRadius = a.getDimension(R.styleable.GlowPadView_innerRadius, mInnerRadius);
mOuterRadius = a.getDimension(R.styleable.GlowPadView_outerRadius, mOuterRadius);
mSnapMargin = a.getDimension(R.styleable.GlowPadView_snapMargin, mSnapMargin);
+ mFirstItemOffset = (float) Math.toRadians(
+ a.getFloat(R.styleable.GlowPadView_firstItemOffset,
+ (float) Math.toDegrees(mFirstItemOffset)));
mVibrationDuration = a.getInt(R.styleable.GlowPadView_vibrationDuration,
mVibrationDuration);
mFeedbackCount = a.getInt(R.styleable.GlowPadView_feedbackCount,
@@ -223,6 +228,7 @@ public class GlowPadView extends View {
getResourceId(a, R.styleable.GlowPadView_outerRingDrawable));
mAlwaysTrackFinger = a.getBoolean(R.styleable.GlowPadView_alwaysTrackFinger, false);
+ mMagneticTargets = a.getBoolean(R.styleable.GlowPadView_magneticTargets, mMagneticTargets);
int pointId = getResourceId(a, R.styleable.GlowPadView_pointDrawable);
Drawable pointDrawable = pointId != 0 ? res.getDrawable(pointId) : null;
@@ -820,6 +826,7 @@ public class GlowPadView extends View {
int ntargets = targets.size();
float x = 0.0f;
float y = 0.0f;
+ float activeAngle = 0.0f;
int actionIndex = event.findPointerIndex(mPointerId);
if (actionIndex == -1) {
@@ -852,15 +859,18 @@ public class GlowPadView extends View {
for (int i = 0; i < ntargets; i++) {
TargetDrawable target = targets.get(i);
- double targetMinRad = (i - 0.5) * 2 * Math.PI / ntargets;
- double targetMaxRad = (i + 0.5) * 2 * Math.PI / ntargets;
+ double targetMinRad = mFirstItemOffset + (i - 0.5) * 2 * Math.PI / ntargets;
+ double targetMaxRad = mFirstItemOffset + (i + 0.5) * 2 * Math.PI / ntargets;
if (target.isEnabled()) {
boolean angleMatches =
(angleRad > targetMinRad && angleRad <= targetMaxRad) ||
(angleRad + 2 * Math.PI > targetMinRad &&
- angleRad + 2 * Math.PI <= targetMaxRad);
+ angleRad + 2 * Math.PI <= targetMaxRad) ||
+ (angleRad - 2 * Math.PI > targetMinRad &&
+ angleRad - 2 * Math.PI <= targetMaxRad);
if (angleMatches && (dist2(tx, ty) > snapDistance2)) {
activeTarget = i;
+ activeAngle = (float) -angleRad;
}
}
}
@@ -888,6 +898,9 @@ public class GlowPadView extends View {
if (target.hasState(TargetDrawable.STATE_FOCUSED)) {
target.setState(TargetDrawable.STATE_INACTIVE);
}
+ if (mMagneticTargets) {
+ updateTargetPosition(mActiveTarget, mWaveCenterX, mWaveCenterY);
+ }
}
// Focus the new target
if (activeTarget != -1) {
@@ -895,6 +908,9 @@ public class GlowPadView extends View {
if (target.hasState(TargetDrawable.STATE_FOCUSED)) {
target.setState(TargetDrawable.STATE_FOCUSED);
}
+ if (mMagneticTargets) {
+ updateTargetPosition(activeTarget, mWaveCenterX, mWaveCenterY, activeAngle);
+ }
if (AccessibilityManager.getInstance(mContext).isEnabled()) {
String targetContentDescription = getTargetDescription(activeTarget);
announceForAccessibility(targetContentDescription);
@@ -1039,14 +1055,15 @@ public class GlowPadView extends View {
if (DEBUG) dump();
}
- private void updateTargetPositions(float centerX, float centerY) {
- // Reposition the target drawables if the view changed.
- ArrayList<TargetDrawable> targets = mTargetDrawables;
- final int size = targets.size();
- final float alpha = (float) (-2.0f * Math.PI / size);
- for (int i = 0; i < size; i++) {
+ private void updateTargetPosition(int i, float centerX, float centerY) {
+ final float angle = getAngle(getSliceAngle(), i);
+ updateTargetPosition(i, centerX, centerY, angle);
+ }
+
+ private void updateTargetPosition(int i, float centerX, float centerY, float angle) {
+ if (i >= 0) {
+ ArrayList<TargetDrawable> targets = mTargetDrawables;
final TargetDrawable targetIcon = targets.get(i);
- final float angle = alpha * i;
targetIcon.setPositionX(centerX);
targetIcon.setPositionY(centerY);
targetIcon.setX(mOuterRadius * (float) Math.cos(angle));
@@ -1054,6 +1071,29 @@ public class GlowPadView extends View {
}
}
+ private void updateTargetPositions(float centerX, float centerY) {
+ updateTargetPositions(centerX, centerY, false);
+ }
+
+ private void updateTargetPositions(float centerX, float centerY, boolean skipActive) {
+ final int size = mTargetDrawables.size();
+ final float alpha = getSliceAngle();
+ // Reposition the target drawables if the view changed.
+ for (int i = 0; i < size; i++) {
+ if (!skipActive || i != mActiveTarget) {
+ updateTargetPosition(i, centerX, centerY, getAngle(alpha, i));
+ }
+ }
+ }
+
+ private float getAngle(float alpha, int i) {
+ return mFirstItemOffset + alpha * i;
+ }
+
+ private float getSliceAngle() {
+ return (float) (-2.0f * Math.PI / mTargetDrawables.size());
+ }
+
private void updatePointCloudPosition(float centerX, float centerY) {
mPointCloud.setCenter(centerX, centerY);
}