Merge "Import translations. DO NOT MERGE"
diff --git a/CleanSpec.mk b/CleanSpec.mk
index d660224..bd3227f 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -225,6 +225,8 @@
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/RsFountainFbo_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/telecomm/java/com/android/internal/telecomm)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/widget/ILockSettingsObserver.java)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/SystemUI_intermediates/)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/Keyguard_intermediates/)
# ******************************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THIS BANNER
diff --git a/core/java/android/hardware/camera2/CameraDevice.java b/core/java/android/hardware/camera2/CameraDevice.java
index 9e90d01..67b480f 100644
--- a/core/java/android/hardware/camera2/CameraDevice.java
+++ b/core/java/android/hardware/camera2/CameraDevice.java
@@ -183,7 +183,7 @@
* Then obtain the Surface with
* {@link android.renderscript.Allocation#getSurface}.</li>
*
- * <li>For access to raw, uncompressed JPEG data in the application: Create an
+ * <li>For access to RAW, uncompressed YUV, or compressed JPEG data in the application: Create an
* {@link android.media.ImageReader} object with one of the supported output formats given by
* {@link StreamConfigurationMap#getOutputFormats()}, setting its size to one of the
* corresponding supported sizes by passing the chosen output format into
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 3694863..1723e96 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1662,11 +1662,12 @@
* the portion of the HTML document that needs to be drawn. These
* optimizations are transparent to the developers. However, under certain
* circumstances, an App developer may want to disable them:
- * 1. When an app uses {@link #onDraw} to do own drawing and accesses portions
- * of the page that is way outside the visible portion of the page.
- * 2. When an app uses {@link #capturePicture} to capture a very large HTML document.
- * Note that capturePicture is a deprecated API.
- *
+ * <ol>
+ * <li>When an app uses {@link #onDraw} to do own drawing and accesses portions
+ * of the page that is way outside the visible portion of the page.</li>
+ * <li>When an app uses {@link #capturePicture} to capture a very large HTML document.
+ * Note that capturePicture is a deprecated API.</li>
+ * </ol>
* Enabling drawing the entire HTML document has a significant performance
* cost. This method should be called before any WebViews are created.
*/
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp
index f506569..1a29a62 100755
--- a/core/jni/android/graphics/Bitmap.cpp
+++ b/core/jni/android/graphics/Bitmap.cpp
@@ -224,37 +224,34 @@
SkColorTable* ctable) {
SkASSERT(width > 0);
const uint8_t* s = (const uint8_t*)src;
- const SkPMColor* colors = ctable->lockColors();
+ const SkPMColor* colors = ctable->readColors();
do {
*dst++ = SkUnPreMultiply::PMColorToColor(colors[*s++]);
} while (--width != 0);
- ctable->unlockColors();
}
static void ToColor_SI8_Raw(SkColor dst[], const void* src, int width,
SkColorTable* ctable) {
SkASSERT(width > 0);
const uint8_t* s = (const uint8_t*)src;
- const SkPMColor* colors = ctable->lockColors();
+ const SkPMColor* colors = ctable->readColors();
do {
SkPMColor c = colors[*s++];
*dst++ = SkColorSetARGB(SkGetPackedA32(c), SkGetPackedR32(c),
SkGetPackedG32(c), SkGetPackedB32(c));
} while (--width != 0);
- ctable->unlockColors();
}
static void ToColor_SI8_Opaque(SkColor dst[], const void* src, int width,
SkColorTable* ctable) {
SkASSERT(width > 0);
const uint8_t* s = (const uint8_t*)src;
- const SkPMColor* colors = ctable->lockColors();
+ const SkPMColor* colors = ctable->readColors();
do {
SkPMColor c = colors[*s++];
*dst++ = SkColorSetRGB(SkGetPackedR32(c), SkGetPackedG32(c),
SkGetPackedB32(c));
} while (--width != 0);
- ctable->unlockColors();
}
// can return NULL
@@ -639,8 +636,7 @@
int count = ctable->count();
p->writeInt32(count);
memcpy(p->writeInplace(count * sizeof(SkPMColor)),
- ctable->lockColors(), count * sizeof(SkPMColor));
- ctable->unlockColors();
+ ctable->readColors(), count * sizeof(SkPMColor));
} else {
p->writeInt32(0); // indicate no ctable
}
@@ -827,10 +823,8 @@
return JNI_FALSE;
}
- SkAutoLockColors alc0(ct0);
- SkAutoLockColors alc1(ct1);
const size_t size = ct0->count() * sizeof(SkPMColor);
- if (memcmp(alc0.colors(), alc1.colors(), size) != 0) {
+ if (memcmp(ct0->readColors(), ct1->readColors(), size) != 0) {
return JNI_FALSE;
}
}
diff --git a/core/jni/android/graphics/Graphics.cpp b/core/jni/android/graphics/Graphics.cpp
index 2ec0828..8e1e8d3 100644
--- a/core/jni/android/graphics/Graphics.cpp
+++ b/core/jni/android/graphics/Graphics.cpp
@@ -8,7 +8,6 @@
#include "SkCanvas.h"
#include "SkDevice.h"
#include "SkMath.h"
-#include "SkPicture.h"
#include "SkRegion.h"
#include <android_runtime/AndroidRuntime.h>
diff --git a/core/jni/android/graphics/Picture.cpp b/core/jni/android/graphics/Picture.cpp
index 33d43083..c249012 100644
--- a/core/jni/android/graphics/Picture.cpp
+++ b/core/jni/android/graphics/Picture.cpp
@@ -27,9 +27,10 @@
mHeight = src->height();
if (NULL != src->mPicture.get()) {
mPicture.reset(SkRef(src->mPicture.get()));
- } if (NULL != src->mRecorder.get()) {
+ } else if (NULL != src->mRecorder.get()) {
mPicture.reset(src->makePartialCopy());
}
+ validate();
} else {
mWidth = 0;
mHeight = 0;
@@ -48,35 +49,31 @@
void Picture::endRecording() {
if (NULL != mRecorder.get()) {
mPicture.reset(mRecorder->endRecording());
+ validate();
mRecorder.reset(NULL);
}
}
int Picture::width() const {
- if (NULL != mPicture.get()) {
- SkASSERT(mPicture->width() == mWidth);
- SkASSERT(mPicture->height() == mHeight);
- }
-
+ validate();
return mWidth;
}
int Picture::height() const {
- if (NULL != mPicture.get()) {
- SkASSERT(mPicture->width() == mWidth);
- SkASSERT(mPicture->height() == mHeight);
- }
-
+ validate();
return mHeight;
}
Picture* Picture::CreateFromStream(SkStream* stream) {
Picture* newPict = new Picture;
- newPict->mPicture.reset(SkPicture::CreateFromStream(stream));
- if (NULL != newPict->mPicture.get()) {
- newPict->mWidth = newPict->mPicture->width();
- newPict->mHeight = newPict->mPicture->height();
+ SkPicture* skPicture = SkPicture::CreateFromStream(stream);
+ if (NULL != skPicture) {
+ newPict->mPicture.reset(skPicture);
+
+ const SkIRect cullRect = skPicture->cullRect().roundOut();
+ newPict->mWidth = cullRect.width();
+ newPict->mHeight = cullRect.height();
}
return newPict;
@@ -87,6 +84,7 @@
SkAutoTDelete<SkPicture> tempPict(this->makePartialCopy());
tempPict->serialize(stream);
} else if (NULL != mPicture.get()) {
+ validate();
mPicture->serialize(stream);
} else {
SkPictureRecorder recorder;
@@ -101,6 +99,7 @@
this->endRecording();
SkASSERT(NULL != mPicture.get());
}
+ validate();
if (NULL != mPicture.get()) {
mPicture.get()->playback(canvas->getSkCanvas());
}
@@ -116,4 +115,14 @@
return reRecorder.endRecording();
}
+void Picture::validate() const {
+#ifdef SK_DEBUG
+ if (NULL != mPicture.get()) {
+ SkRect cullRect = mPicture->cullRect();
+ SkRect myRect = SkRect::MakeWH(SkIntToScalar(mWidth), SkIntToScalar(mHeight));
+ SkASSERT(cullRect == myRect);
+ }
+#endif
+}
+
}; // namespace android
diff --git a/core/jni/android/graphics/Picture.h b/core/jni/android/graphics/Picture.h
index 4db923d..a9db648 100644
--- a/core/jni/android/graphics/Picture.h
+++ b/core/jni/android/graphics/Picture.h
@@ -60,6 +60,8 @@
// Make a copy of a picture that is in the midst of being recorded. The
// resulting picture will have balanced saves and restores.
SkPicture* makePartialCopy() const;
+
+ void validate() const;
};
}; // namespace android
diff --git a/core/jni/android/graphics/pdf/PdfDocument.cpp b/core/jni/android/graphics/pdf/PdfDocument.cpp
index 8ba164f..a91b15b 100644
--- a/core/jni/android/graphics/pdf/PdfDocument.cpp
+++ b/core/jni/android/graphics/pdf/PdfDocument.cpp
@@ -71,7 +71,7 @@
mCurrentPage = page;
SkCanvas* canvas = page->mPictureRecorder->beginRecording(
- contentRect.width(), contentRect.height(), NULL, 0);
+ SkRect::MakeWH(contentRect.width(), contentRect.height()));
return canvas;
}
diff --git a/core/jni/android/graphics/pdf/PdfEditor.cpp b/core/jni/android/graphics/pdf/PdfEditor.cpp
index cb228f2..84434ae 100644
--- a/core/jni/android/graphics/pdf/PdfEditor.cpp
+++ b/core/jni/android/graphics/pdf/PdfEditor.cpp
@@ -201,7 +201,11 @@
SkMatrix* skTransform = reinterpret_cast<SkMatrix*>(transformPtr);
SkScalar transformValues[6];
- skTransform->asAffine(transformValues);
+ if (!skTransform->asAffine(transformValues)) {
+ jniThrowException(env, "java/lang/IllegalArgumentException",
+ "transform matrix has perspective. Only affine matrices are allowed.");
+ return;
+ }
// PDF's coordinate system origin is left-bottom while in graphics it
// is the top-left. So, translate the PDF coordinates to ours.
diff --git a/core/jni/android/graphics/pdf/PdfRenderer.cpp b/core/jni/android/graphics/pdf/PdfRenderer.cpp
index ae23cb4..fc98cf9 100644
--- a/core/jni/android/graphics/pdf/PdfRenderer.cpp
+++ b/core/jni/android/graphics/pdf/PdfRenderer.cpp
@@ -219,11 +219,16 @@
matrix.Set(1, 0, 0, -1, 0, pPage->GetPageHeight());
SkScalar transformValues[6];
- transform->asAffine(transformValues);
+ if (transform->asAffine(transformValues)) {
+ matrix.Concat(transformValues[SkMatrix::kAScaleX], transformValues[SkMatrix::kASkewY],
+ transformValues[SkMatrix::kASkewX], transformValues[SkMatrix::kAScaleY],
+ transformValues[SkMatrix::kATransX], transformValues[SkMatrix::kATransY]);
+ } else {
+ // Already checked for a return value of false in the caller, so this should never
+ // happen.
+ ALOGE("Error rendering page!");
+ }
- matrix.Concat(transformValues[SkMatrix::kAScaleX], transformValues[SkMatrix::kASkewY],
- transformValues[SkMatrix::kASkewX], transformValues[SkMatrix::kAScaleY],
- transformValues[SkMatrix::kATransX], transformValues[SkMatrix::kATransY]);
}
pageContext->AppendObjectList(pPage, &matrix);
@@ -264,6 +269,12 @@
renderFlags |= FPDF_PRINTING;
}
+ if (skMatrix && !skMatrix->asAffine(NULL)) {
+ jniThrowException(env, "java/lang/IllegalArgumentException",
+ "transform matrix has perspective. Only affine matrices are allowed.");
+ return;
+ }
+
renderPageBitmap(bitmap, page, destLeft, destTop, destRight,
destBottom, skMatrix, renderFlags);
diff --git a/core/jni/android/opengl/util.cpp b/core/jni/android/opengl/util.cpp
index da30044..461507f 100644
--- a/core/jni/android/opengl/util.cpp
+++ b/core/jni/android/opengl/util.cpp
@@ -675,9 +675,8 @@
if (data) {
void* const pixels = (char*)data + palette_size;
SkColorTable* ctable = bitmap.getColorTable();
- memcpy(data, ctable->lockColors(), ctable->count() * sizeof(SkPMColor));
+ memcpy(data, ctable->readColors(), ctable->count() * sizeof(SkPMColor));
memcpy(pixels, p, size);
- ctable->unlockColors();
glCompressedTexImage2D(target, level, internalformat, w, h, border, imageSize, data);
free(data);
} else {
diff --git a/libs/hwui/DamageAccumulator.cpp b/libs/hwui/DamageAccumulator.cpp
index a422622..9bd3bdc 100644
--- a/libs/hwui/DamageAccumulator.cpp
+++ b/libs/hwui/DamageAccumulator.cpp
@@ -222,7 +222,7 @@
LOG_ALWAYS_FATAL_IF(mHead->prev != mHead, "Cannot finish, mismatched push/pop calls! %p vs. %p", mHead->prev, mHead);
// Root node never has a transform, so this is the fully mapped dirty rect
*totalDirty = mHead->pendingDirty;
- totalDirty->roundOut();
+ totalDirty->roundOut(totalDirty);
mHead->pendingDirty.setEmpty();
}
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index b448949..5a7ea40 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -223,7 +223,7 @@
}
if (dirty.intersect(0, 0, getWidth(), getHeight())) {
- dirty.roundOut();
+ dirty.roundOut(&dirty);
mLayer->updateDeferred(this, dirty.fLeft, dirty.fTop, dirty.fRight, dirty.fBottom);
}
// This is not inside the above if because we may have called
diff --git a/packages/Keyguard/res/anim/keyguard_action_assist_enter.xml b/packages/Keyguard/res/anim/keyguard_action_assist_enter.xml
deleted file mode 100644
index f3333b7..0000000
--- a/packages/Keyguard/res/anim/keyguard_action_assist_enter.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:shareInterpolator="false" android:zAdjustment="top">
-
- <alpha android:fromAlpha="0" android:toAlpha="1.0"
- android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/decelerate_cubic"
- android:duration="300"/>
-
- <translate android:fromYDelta="100%" android:toYDelta="0"
- android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/decelerate_cubic"
- android:duration="300" />
-</set>
diff --git a/packages/Keyguard/res/anim/keyguard_action_assist_exit.xml b/packages/Keyguard/res/anim/keyguard_action_assist_exit.xml
deleted file mode 100644
index b4ed278..0000000
--- a/packages/Keyguard/res/anim/keyguard_action_assist_exit.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<translate xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/accelerate_interpolator"
- android:fromXDelta="0" android:toXDelta="0"
- android:duration="300" />
diff --git a/packages/Keyguard/res/anim/lock_screen_enter.xml b/packages/Keyguard/res/anim/lock_screen_enter.xml
deleted file mode 100644
index 4344cf9..0000000
--- a/packages/Keyguard/res/anim/lock_screen_enter.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2007, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:interpolator/accelerate_cubic">
- <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
- android:duration="@integer/config_activityDefaultDur" />
-</set>
diff --git a/packages/Keyguard/res/anim/lock_screen_exit.xml b/packages/Keyguard/res/anim/lock_screen_exit.xml
deleted file mode 100644
index c75b3cc..0000000
--- a/packages/Keyguard/res/anim/lock_screen_exit.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2007, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:zAdjustment="top"
- android:shareInterpolator="false">
- <scale
- android:fromXScale="1.0" android:toXScale="1.10"
- android:fromYScale="1.0" android:toYScale="1.10"
- android:pivotX="50%p" android:pivotY="50%p"
- android:fillEnabled="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/accelerate_quint"
- android:duration="@android:integer/config_shortAnimTime" />
- <alpha
- android:fromAlpha="1.0" android:toAlpha="0"
- android:fillEnabled="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/accelerate_quad"
- android:duration="@android:integer/config_shortAnimTime"/>
-</set>
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_facial_backup.png b/packages/Keyguard/res/drawable-hdpi/ic_facial_backup.png
deleted file mode 100644
index 2956109..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_facial_backup.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_camera_activated.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_camera_activated.png
deleted file mode 100644
index 19c8eb2..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_camera_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_camera_normal.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_camera_normal.png
deleted file mode 100644
index c79a245..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_camera_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_emergencycall_normal.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_emergencycall_normal.png
deleted file mode 100644
index 460495a..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_emergencycall_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_emergencycall_pressed.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_emergencycall_pressed.png
deleted file mode 100644
index b0f7ae9..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_emergencycall_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_glowdot.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_glowdot.png
deleted file mode 100644
index 983c45e..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_glowdot.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_google_activated.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_google_activated.png
deleted file mode 100644
index 2c4847c..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_google_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_google_focused.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_google_focused.png
deleted file mode 100644
index d98557d..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_google_focused.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_google_normal.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_google_normal.png
deleted file mode 100644
index 656f3ba..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_google_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_handle_normal.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_handle_normal.png
deleted file mode 100644
index 1780ec0..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_handle_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_handle_pressed.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_handle_pressed.png
deleted file mode 100644
index 58a5f16..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_handle_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_lock_normal.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_lock_normal.png
deleted file mode 100644
index 732133c..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_lock_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_lock_pressed.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_lock_pressed.png
deleted file mode 100644
index 0bbf62f..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_lock_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_player_background.9.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_player_background.9.png
deleted file mode 100644
index fbb75b5..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_player_background.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_search_activated.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_search_activated.png
deleted file mode 100644
index 0d2e2ef..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_search_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_search_normal.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_search_normal.png
deleted file mode 100644
index 66d14ae..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_search_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_silent_activated.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_silent_activated.png
deleted file mode 100644
index 7060d59..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_silent_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_silent_focused.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_silent_focused.png
deleted file mode 100644
index f9a8c7c..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_silent_focused.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_silent_normal.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_silent_normal.png
deleted file mode 100644
index b47cd08..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_silent_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_soundon_activated.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_soundon_activated.png
deleted file mode 100644
index 88d0a9f..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_soundon_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_soundon_focused.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_soundon_focused.png
deleted file mode 100644
index 6e16e40..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_soundon_focused.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_soundon_normal.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_soundon_normal.png
deleted file mode 100644
index 0dd81c0..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_soundon_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_unlock_activated.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_unlock_activated.png
deleted file mode 100644
index 374a62a..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_unlock_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_unlock_normal.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_unlock_normal.png
deleted file mode 100644
index 3960893..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_unlock_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_media_next.png b/packages/Keyguard/res/drawable-hdpi/ic_media_next.png
deleted file mode 100644
index 6e27b81..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_media_next.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_media_play.png b/packages/Keyguard/res/drawable-hdpi/ic_media_play.png
deleted file mode 100644
index 2746d17..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_media_play.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_media_previous.png b/packages/Keyguard/res/drawable-hdpi/ic_media_previous.png
deleted file mode 100644
index 85b3766..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_media_previous.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/intro_bg.png b/packages/Keyguard/res/drawable-hdpi/intro_bg.png
deleted file mode 100644
index a758e7d..0000000
--- a/packages/Keyguard/res/drawable-hdpi/intro_bg.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/kg_add_widget.png b/packages/Keyguard/res/drawable-hdpi/kg_add_widget.png
deleted file mode 100644
index 7456705b..0000000
--- a/packages/Keyguard/res/drawable-hdpi/kg_add_widget.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/kg_add_widget_disabled.png b/packages/Keyguard/res/drawable-hdpi/kg_add_widget_disabled.png
deleted file mode 100644
index f24cf642..0000000
--- a/packages/Keyguard/res/drawable-hdpi/kg_add_widget_disabled.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/kg_add_widget_pressed.png b/packages/Keyguard/res/drawable-hdpi/kg_add_widget_pressed.png
deleted file mode 100644
index 70a960d..0000000
--- a/packages/Keyguard/res/drawable-hdpi/kg_add_widget_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/kg_security_grip.9.png b/packages/Keyguard/res/drawable-hdpi/kg_security_grip.9.png
deleted file mode 100644
index 1e40aef..0000000
--- a/packages/Keyguard/res/drawable-hdpi/kg_security_grip.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/kg_security_lock.png b/packages/Keyguard/res/drawable-hdpi/kg_security_lock.png
deleted file mode 100644
index c3c94c4..0000000
--- a/packages/Keyguard/res/drawable-hdpi/kg_security_lock.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/kg_security_lock_focused.png b/packages/Keyguard/res/drawable-hdpi/kg_security_lock_focused.png
deleted file mode 100644
index 9a82799..0000000
--- a/packages/Keyguard/res/drawable-hdpi/kg_security_lock_focused.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/kg_security_lock_pressed.png b/packages/Keyguard/res/drawable-hdpi/kg_security_lock_pressed.png
deleted file mode 100644
index 7ca995d..0000000
--- a/packages/Keyguard/res/drawable-hdpi/kg_security_lock_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/kg_widget_bg_padded.9.png b/packages/Keyguard/res/drawable-hdpi/kg_widget_bg_padded.9.png
deleted file mode 100644
index 476a826..0000000
--- a/packages/Keyguard/res/drawable-hdpi/kg_widget_bg_padded.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/kg_widget_delete_drop_target.png b/packages/Keyguard/res/drawable-hdpi/kg_widget_delete_drop_target.png
deleted file mode 100644
index 84549ff..0000000
--- a/packages/Keyguard/res/drawable-hdpi/kg_widget_delete_drop_target.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/lockscreen_protection_pattern.png b/packages/Keyguard/res/drawable-hdpi/lockscreen_protection_pattern.png
deleted file mode 100644
index 681d8be..0000000
--- a/packages/Keyguard/res/drawable-hdpi/lockscreen_protection_pattern.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/progress_bg_holo_light.9.png b/packages/Keyguard/res/drawable-hdpi/progress_bg_holo_light.9.png
deleted file mode 100644
index 2d79280..0000000
--- a/packages/Keyguard/res/drawable-hdpi/progress_bg_holo_light.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/progress_primary_holo_light.9.png b/packages/Keyguard/res/drawable-hdpi/progress_primary_holo_light.9.png
deleted file mode 100644
index 543cb85..0000000
--- a/packages/Keyguard/res/drawable-hdpi/progress_primary_holo_light.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/progress_secondary_holo_light.9.png b/packages/Keyguard/res/drawable-hdpi/progress_secondary_holo_light.9.png
deleted file mode 100644
index 4497058..0000000
--- a/packages/Keyguard/res/drawable-hdpi/progress_secondary_holo_light.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/scrubber_control_disabled_holo.png b/packages/Keyguard/res/drawable-hdpi/scrubber_control_disabled_holo.png
deleted file mode 100644
index ba77899..0000000
--- a/packages/Keyguard/res/drawable-hdpi/scrubber_control_disabled_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/scrubber_control_focused_holo.png b/packages/Keyguard/res/drawable-hdpi/scrubber_control_focused_holo.png
deleted file mode 100644
index 539ee22..0000000
--- a/packages/Keyguard/res/drawable-hdpi/scrubber_control_focused_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/scrubber_control_normal_holo.png b/packages/Keyguard/res/drawable-hdpi/scrubber_control_normal_holo.png
deleted file mode 100644
index 9a4ea2f..0000000
--- a/packages/Keyguard/res/drawable-hdpi/scrubber_control_normal_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/scrubber_control_pressed_holo.png b/packages/Keyguard/res/drawable-hdpi/scrubber_control_pressed_holo.png
deleted file mode 100644
index e6b11de..0000000
--- a/packages/Keyguard/res/drawable-hdpi/scrubber_control_pressed_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/scrubber_primary_holo.9.png b/packages/Keyguard/res/drawable-hdpi/scrubber_primary_holo.9.png
deleted file mode 100644
index 822e8d11..0000000
--- a/packages/Keyguard/res/drawable-hdpi/scrubber_primary_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/scrubber_secondary_holo.9.png b/packages/Keyguard/res/drawable-hdpi/scrubber_secondary_holo.9.png
deleted file mode 100644
index be4253e..0000000
--- a/packages/Keyguard/res/drawable-hdpi/scrubber_secondary_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/scrubber_track_holo_light.9.png b/packages/Keyguard/res/drawable-hdpi/scrubber_track_holo_light.9.png
deleted file mode 100644
index 2334e14..0000000
--- a/packages/Keyguard/res/drawable-hdpi/scrubber_track_holo_light.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/sym_keyboard_return_holo.png b/packages/Keyguard/res/drawable-hdpi/sym_keyboard_return_holo.png
deleted file mode 100644
index f1bcf48..0000000
--- a/packages/Keyguard/res/drawable-hdpi/sym_keyboard_return_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-ldpi/ic_input_delete.png b/packages/Keyguard/res/drawable-ldpi/ic_input_delete.png
deleted file mode 100644
index d7eff17..0000000
--- a/packages/Keyguard/res/drawable-ldpi/ic_input_delete.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-ldpi/ic_media_next.png b/packages/Keyguard/res/drawable-ldpi/ic_media_next.png
deleted file mode 100644
index 99927fd..0000000
--- a/packages/Keyguard/res/drawable-ldpi/ic_media_next.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-ldpi/ic_media_play.png b/packages/Keyguard/res/drawable-ldpi/ic_media_play.png
deleted file mode 100644
index e7c1972..0000000
--- a/packages/Keyguard/res/drawable-ldpi/ic_media_play.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-ldpi/ic_media_previous.png b/packages/Keyguard/res/drawable-ldpi/ic_media_previous.png
deleted file mode 100644
index df04322..0000000
--- a/packages/Keyguard/res/drawable-ldpi/ic_media_previous.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_facial_backup.png b/packages/Keyguard/res/drawable-mdpi/ic_facial_backup.png
deleted file mode 100644
index 6ed1327..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_facial_backup.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_camera_activated.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_camera_activated.png
deleted file mode 100644
index 862f33bf..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_camera_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_camera_normal.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_camera_normal.png
deleted file mode 100644
index 30df0a3..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_camera_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_emergencycall_normal.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_emergencycall_normal.png
deleted file mode 100644
index cae795f..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_emergencycall_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_emergencycall_pressed.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_emergencycall_pressed.png
deleted file mode 100644
index 2867956..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_emergencycall_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_glowdot.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_glowdot.png
deleted file mode 100644
index 056c3f17..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_glowdot.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_google_activated.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_google_activated.png
deleted file mode 100644
index 32a68e0..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_google_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_google_focused.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_google_focused.png
deleted file mode 100644
index 3f96d03..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_google_focused.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_google_normal.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_google_normal.png
deleted file mode 100644
index 2f7efcf..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_google_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_handle_normal.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_handle_normal.png
deleted file mode 100644
index 1d547e1..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_handle_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_handle_pressed.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_handle_pressed.png
deleted file mode 100644
index 0187a02..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_handle_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_lock_normal.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_lock_normal.png
deleted file mode 100644
index 30eb974..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_lock_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_lock_pressed.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_lock_pressed.png
deleted file mode 100644
index aab2f6b..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_lock_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_player_background.9.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_player_background.9.png
deleted file mode 100644
index 17d97c4..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_player_background.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_search_activated.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_search_activated.png
deleted file mode 100644
index 73c6be6..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_search_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_search_normal.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_search_normal.png
deleted file mode 100644
index 73c6be6..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_search_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_silent_activated.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_silent_activated.png
deleted file mode 100644
index 2bc3f52..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_silent_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_silent_focused.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_silent_focused.png
deleted file mode 100644
index 6a5af9d..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_silent_focused.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_silent_normal.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_silent_normal.png
deleted file mode 100644
index c288ce4..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_silent_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_soundon_activated.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_soundon_activated.png
deleted file mode 100644
index 637eec6..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_soundon_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_soundon_focused.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_soundon_focused.png
deleted file mode 100644
index db59b5f..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_soundon_focused.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_soundon_normal.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_soundon_normal.png
deleted file mode 100644
index eb6ceed..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_soundon_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_unlock_activated.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_unlock_activated.png
deleted file mode 100644
index 68409c5..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_unlock_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_unlock_normal.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_unlock_normal.png
deleted file mode 100644
index 52866f2..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_unlock_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_media_next.png b/packages/Keyguard/res/drawable-mdpi/ic_media_next.png
deleted file mode 100644
index fcd73d9..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_media_next.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_media_play.png b/packages/Keyguard/res/drawable-mdpi/ic_media_play.png
deleted file mode 100644
index 7966bbc..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_media_play.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_media_previous.png b/packages/Keyguard/res/drawable-mdpi/ic_media_previous.png
deleted file mode 100644
index b653d05..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_media_previous.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/intro_bg.png b/packages/Keyguard/res/drawable-mdpi/intro_bg.png
deleted file mode 100644
index 540da31..0000000
--- a/packages/Keyguard/res/drawable-mdpi/intro_bg.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/kg_add_widget.png b/packages/Keyguard/res/drawable-mdpi/kg_add_widget.png
deleted file mode 100644
index 1cab0d9..0000000
--- a/packages/Keyguard/res/drawable-mdpi/kg_add_widget.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/kg_add_widget_disabled.png b/packages/Keyguard/res/drawable-mdpi/kg_add_widget_disabled.png
deleted file mode 100644
index 02e0f0e..0000000
--- a/packages/Keyguard/res/drawable-mdpi/kg_add_widget_disabled.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/kg_add_widget_pressed.png b/packages/Keyguard/res/drawable-mdpi/kg_add_widget_pressed.png
deleted file mode 100644
index a68d4c1..0000000
--- a/packages/Keyguard/res/drawable-mdpi/kg_add_widget_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/kg_security_grip.9.png b/packages/Keyguard/res/drawable-mdpi/kg_security_grip.9.png
deleted file mode 100644
index 334a39b..0000000
--- a/packages/Keyguard/res/drawable-mdpi/kg_security_grip.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/kg_security_lock.png b/packages/Keyguard/res/drawable-mdpi/kg_security_lock.png
deleted file mode 100644
index a39f380..0000000
--- a/packages/Keyguard/res/drawable-mdpi/kg_security_lock.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/kg_security_lock_focused.png b/packages/Keyguard/res/drawable-mdpi/kg_security_lock_focused.png
deleted file mode 100644
index c3608f9..0000000
--- a/packages/Keyguard/res/drawable-mdpi/kg_security_lock_focused.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/kg_security_lock_pressed.png b/packages/Keyguard/res/drawable-mdpi/kg_security_lock_pressed.png
deleted file mode 100644
index 41715f5..0000000
--- a/packages/Keyguard/res/drawable-mdpi/kg_security_lock_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/kg_widget_bg_padded.9.png b/packages/Keyguard/res/drawable-mdpi/kg_widget_bg_padded.9.png
deleted file mode 100644
index aa441de..0000000
--- a/packages/Keyguard/res/drawable-mdpi/kg_widget_bg_padded.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/kg_widget_delete_drop_target.png b/packages/Keyguard/res/drawable-mdpi/kg_widget_delete_drop_target.png
deleted file mode 100644
index 219f3e5..0000000
--- a/packages/Keyguard/res/drawable-mdpi/kg_widget_delete_drop_target.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/lockscreen_protection_pattern.png b/packages/Keyguard/res/drawable-mdpi/lockscreen_protection_pattern.png
deleted file mode 100644
index 30bcea5..0000000
--- a/packages/Keyguard/res/drawable-mdpi/lockscreen_protection_pattern.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/progress_bg_holo_light.9.png b/packages/Keyguard/res/drawable-mdpi/progress_bg_holo_light.9.png
deleted file mode 100644
index ff40433..0000000
--- a/packages/Keyguard/res/drawable-mdpi/progress_bg_holo_light.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/progress_primary_holo_light.9.png b/packages/Keyguard/res/drawable-mdpi/progress_primary_holo_light.9.png
deleted file mode 100644
index d5f874d..0000000
--- a/packages/Keyguard/res/drawable-mdpi/progress_primary_holo_light.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/progress_secondary_holo_light.9.png b/packages/Keyguard/res/drawable-mdpi/progress_secondary_holo_light.9.png
deleted file mode 100644
index f027007..0000000
--- a/packages/Keyguard/res/drawable-mdpi/progress_secondary_holo_light.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/scrubber_control_disabled_holo.png b/packages/Keyguard/res/drawable-mdpi/scrubber_control_disabled_holo.png
deleted file mode 100644
index 981facd..0000000
--- a/packages/Keyguard/res/drawable-mdpi/scrubber_control_disabled_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/scrubber_control_focused_holo.png b/packages/Keyguard/res/drawable-mdpi/scrubber_control_focused_holo.png
deleted file mode 100644
index d432f42..0000000
--- a/packages/Keyguard/res/drawable-mdpi/scrubber_control_focused_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/scrubber_control_normal_holo.png b/packages/Keyguard/res/drawable-mdpi/scrubber_control_normal_holo.png
deleted file mode 100644
index 7bb749e..0000000
--- a/packages/Keyguard/res/drawable-mdpi/scrubber_control_normal_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/scrubber_control_pressed_holo.png b/packages/Keyguard/res/drawable-mdpi/scrubber_control_pressed_holo.png
deleted file mode 100644
index 43d826e..0000000
--- a/packages/Keyguard/res/drawable-mdpi/scrubber_control_pressed_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/scrubber_primary_holo.9.png b/packages/Keyguard/res/drawable-mdpi/scrubber_primary_holo.9.png
deleted file mode 100644
index 98ac428..0000000
--- a/packages/Keyguard/res/drawable-mdpi/scrubber_primary_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/scrubber_secondary_holo.9.png b/packages/Keyguard/res/drawable-mdpi/scrubber_secondary_holo.9.png
deleted file mode 100644
index d8b563b..0000000
--- a/packages/Keyguard/res/drawable-mdpi/scrubber_secondary_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/scrubber_track_holo_light.9.png b/packages/Keyguard/res/drawable-mdpi/scrubber_track_holo_light.9.png
deleted file mode 100644
index 47c5dd9..0000000
--- a/packages/Keyguard/res/drawable-mdpi/scrubber_track_holo_light.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/sym_keyboard_return_holo.png b/packages/Keyguard/res/drawable-mdpi/sym_keyboard_return_holo.png
deleted file mode 100644
index d5a7708..0000000
--- a/packages/Keyguard/res/drawable-mdpi/sym_keyboard_return_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-sw600dp-hdpi/ic_lockscreen_handle_normal.png b/packages/Keyguard/res/drawable-sw600dp-hdpi/ic_lockscreen_handle_normal.png
deleted file mode 100644
index f28fe38..0000000
--- a/packages/Keyguard/res/drawable-sw600dp-hdpi/ic_lockscreen_handle_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-sw600dp-hdpi/ic_lockscreen_handle_pressed.png b/packages/Keyguard/res/drawable-sw600dp-hdpi/ic_lockscreen_handle_pressed.png
deleted file mode 100644
index 728fc67..0000000
--- a/packages/Keyguard/res/drawable-sw600dp-hdpi/ic_lockscreen_handle_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-sw600dp-mdpi/ic_lockscreen_handle_normal.png b/packages/Keyguard/res/drawable-sw600dp-mdpi/ic_lockscreen_handle_normal.png
deleted file mode 100644
index 99e742f..0000000
--- a/packages/Keyguard/res/drawable-sw600dp-mdpi/ic_lockscreen_handle_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-sw600dp-mdpi/ic_lockscreen_handle_pressed.png b/packages/Keyguard/res/drawable-sw600dp-mdpi/ic_lockscreen_handle_pressed.png
deleted file mode 100644
index c7da024..0000000
--- a/packages/Keyguard/res/drawable-sw600dp-mdpi/ic_lockscreen_handle_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-sw600dp-xhdpi/ic_lockscreen_handle_normal.png b/packages/Keyguard/res/drawable-sw600dp-xhdpi/ic_lockscreen_handle_normal.png
deleted file mode 100644
index 75e4783..0000000
--- a/packages/Keyguard/res/drawable-sw600dp-xhdpi/ic_lockscreen_handle_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-sw600dp-xhdpi/ic_lockscreen_handle_pressed.png b/packages/Keyguard/res/drawable-sw600dp-xhdpi/ic_lockscreen_handle_pressed.png
deleted file mode 100644
index 534c10b..0000000
--- a/packages/Keyguard/res/drawable-sw600dp-xhdpi/ic_lockscreen_handle_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_facial_backup.png b/packages/Keyguard/res/drawable-xhdpi/ic_facial_backup.png
deleted file mode 100644
index 942cf23..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_facial_backup.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_camera_activated.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_camera_activated.png
deleted file mode 100644
index 760ef2d..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_camera_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_camera_normal.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_camera_normal.png
deleted file mode 100644
index 093bc05..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_camera_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_emergencycall_normal.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_emergencycall_normal.png
deleted file mode 100644
index a61f7a5..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_emergencycall_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_emergencycall_pressed.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_emergencycall_pressed.png
deleted file mode 100644
index dd5e481..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_emergencycall_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_glowdot.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_glowdot.png
deleted file mode 100644
index cbd039a..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_glowdot.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_google_activated.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_google_activated.png
deleted file mode 100644
index d643f83..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_google_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_google_focused.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_google_focused.png
deleted file mode 100644
index 51863f4..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_google_focused.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_google_normal.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_google_normal.png
deleted file mode 100644
index 9a9bf68..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_google_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_handle_normal.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_handle_normal.png
deleted file mode 100644
index b09071b..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_handle_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_handle_pressed.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_handle_pressed.png
deleted file mode 100644
index 2d28009..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_handle_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_lock_normal.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_lock_normal.png
deleted file mode 100644
index c44a330..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_lock_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_lock_pressed.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_lock_pressed.png
deleted file mode 100644
index 2264dc3..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_lock_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_player_background.9.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_player_background.9.png
deleted file mode 100644
index 393bca6..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_player_background.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_silent_activated.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_silent_activated.png
deleted file mode 100644
index 2900045..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_silent_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_silent_focused.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_silent_focused.png
deleted file mode 100644
index 5a93472..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_silent_focused.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_silent_normal.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_silent_normal.png
deleted file mode 100644
index 73f6a2e..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_silent_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_soundon_activated.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_soundon_activated.png
deleted file mode 100644
index da2adc2..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_soundon_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_soundon_focused.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_soundon_focused.png
deleted file mode 100644
index 0485af0..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_soundon_focused.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_soundon_normal.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_soundon_normal.png
deleted file mode 100644
index 6af5375..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_soundon_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_unlock_activated.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_unlock_activated.png
deleted file mode 100644
index 8a0331d..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_unlock_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_unlock_normal.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_unlock_normal.png
deleted file mode 100644
index 0422117..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_unlock_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_media_next.png b/packages/Keyguard/res/drawable-xhdpi/ic_media_next.png
deleted file mode 100644
index 4def965..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_media_next.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_media_play.png b/packages/Keyguard/res/drawable-xhdpi/ic_media_play.png
deleted file mode 100644
index ccfef18..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_media_play.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_media_previous.png b/packages/Keyguard/res/drawable-xhdpi/ic_media_previous.png
deleted file mode 100644
index c4472ae..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_media_previous.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/intro_bg.png b/packages/Keyguard/res/drawable-xhdpi/intro_bg.png
deleted file mode 100644
index 00466c5..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/intro_bg.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/kg_add_widget.png b/packages/Keyguard/res/drawable-xhdpi/kg_add_widget.png
deleted file mode 100644
index d71905f..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/kg_add_widget.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/kg_add_widget_disabled.png b/packages/Keyguard/res/drawable-xhdpi/kg_add_widget_disabled.png
deleted file mode 100644
index 55fa1ac..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/kg_add_widget_disabled.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/kg_add_widget_pressed.png b/packages/Keyguard/res/drawable-xhdpi/kg_add_widget_pressed.png
deleted file mode 100644
index edf7070..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/kg_add_widget_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/kg_security_grip.9.png b/packages/Keyguard/res/drawable-xhdpi/kg_security_grip.9.png
deleted file mode 100644
index c33b9d3..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/kg_security_grip.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/kg_security_lock.png b/packages/Keyguard/res/drawable-xhdpi/kg_security_lock.png
deleted file mode 100644
index 81d577e..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/kg_security_lock.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/kg_security_lock_focused.png b/packages/Keyguard/res/drawable-xhdpi/kg_security_lock_focused.png
deleted file mode 100644
index db22016..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/kg_security_lock_focused.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/kg_security_lock_pressed.png b/packages/Keyguard/res/drawable-xhdpi/kg_security_lock_pressed.png
deleted file mode 100644
index 186b6ff..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/kg_security_lock_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/kg_widget_bg_padded.9.png b/packages/Keyguard/res/drawable-xhdpi/kg_widget_bg_padded.9.png
deleted file mode 100644
index 6c372dd..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/kg_widget_bg_padded.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/kg_widget_delete_drop_target.png b/packages/Keyguard/res/drawable-xhdpi/kg_widget_delete_drop_target.png
deleted file mode 100644
index d4965d9..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/kg_widget_delete_drop_target.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/lockscreen_protection_pattern.png b/packages/Keyguard/res/drawable-xhdpi/lockscreen_protection_pattern.png
deleted file mode 100644
index c13afe2..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/lockscreen_protection_pattern.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/progress_bg_holo_light.9.png b/packages/Keyguard/res/drawable-xhdpi/progress_bg_holo_light.9.png
deleted file mode 100644
index dff0939..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/progress_bg_holo_light.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/progress_primary_holo_light.9.png b/packages/Keyguard/res/drawable-xhdpi/progress_primary_holo_light.9.png
deleted file mode 100644
index 60b8198..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/progress_primary_holo_light.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/progress_secondary_holo_light.9.png b/packages/Keyguard/res/drawable-xhdpi/progress_secondary_holo_light.9.png
deleted file mode 100644
index 11b31be..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/progress_secondary_holo_light.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/scrubber_control_disabled_holo.png b/packages/Keyguard/res/drawable-xhdpi/scrubber_control_disabled_holo.png
deleted file mode 100644
index ffe913d..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/scrubber_control_disabled_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/scrubber_control_focused_holo.png b/packages/Keyguard/res/drawable-xhdpi/scrubber_control_focused_holo.png
deleted file mode 100644
index 2fccb8f..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/scrubber_control_focused_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/scrubber_control_normal_holo.png b/packages/Keyguard/res/drawable-xhdpi/scrubber_control_normal_holo.png
deleted file mode 100644
index a638501..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/scrubber_control_normal_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/scrubber_control_pressed_holo.png b/packages/Keyguard/res/drawable-xhdpi/scrubber_control_pressed_holo.png
deleted file mode 100644
index f0e65ea..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/scrubber_control_pressed_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/scrubber_primary_holo.9.png b/packages/Keyguard/res/drawable-xhdpi/scrubber_primary_holo.9.png
deleted file mode 100644
index 04f6ae3..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/scrubber_primary_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/scrubber_secondary_holo.9.png b/packages/Keyguard/res/drawable-xhdpi/scrubber_secondary_holo.9.png
deleted file mode 100644
index 7fef98d..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/scrubber_secondary_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/scrubber_track_holo_light.9.png b/packages/Keyguard/res/drawable-xhdpi/scrubber_track_holo_light.9.png
deleted file mode 100644
index a712169..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/scrubber_track_holo_light.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/sym_keyboard_return_holo.png b/packages/Keyguard/res/drawable-xhdpi/sym_keyboard_return_holo.png
deleted file mode 100644
index 55174e0..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/sym_keyboard_return_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xxhdpi/kg_add_widget_pressed.png b/packages/Keyguard/res/drawable-xxhdpi/kg_add_widget_pressed.png
deleted file mode 100644
index 0c0838b..0000000
--- a/packages/Keyguard/res/drawable-xxhdpi/kg_add_widget_pressed.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xxhdpi/kg_widget_bg_padded.9.png b/packages/Keyguard/res/drawable-xxhdpi/kg_widget_bg_padded.9.png
deleted file mode 100644
index f4e398b..0000000
--- a/packages/Keyguard/res/drawable-xxhdpi/kg_widget_bg_padded.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xxhdpi/progress_bg_holo_light.9.png b/packages/Keyguard/res/drawable-xxhdpi/progress_bg_holo_light.9.png
deleted file mode 100644
index 60a8e22..0000000
--- a/packages/Keyguard/res/drawable-xxhdpi/progress_bg_holo_light.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xxhdpi/progress_primary_holo_light.9.png b/packages/Keyguard/res/drawable-xxhdpi/progress_primary_holo_light.9.png
deleted file mode 100644
index 18384d3..0000000
--- a/packages/Keyguard/res/drawable-xxhdpi/progress_primary_holo_light.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xxhdpi/progress_secondary_holo_light.9.png b/packages/Keyguard/res/drawable-xxhdpi/progress_secondary_holo_light.9.png
deleted file mode 100644
index 82eb615..0000000
--- a/packages/Keyguard/res/drawable-xxhdpi/progress_secondary_holo_light.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xxhdpi/scrubber_control_disabled_holo.png b/packages/Keyguard/res/drawable-xxhdpi/scrubber_control_disabled_holo.png
deleted file mode 100644
index d1ac7ae..0000000
--- a/packages/Keyguard/res/drawable-xxhdpi/scrubber_control_disabled_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xxhdpi/scrubber_control_focused_holo.png b/packages/Keyguard/res/drawable-xxhdpi/scrubber_control_focused_holo.png
deleted file mode 100644
index 58a2976..0000000
--- a/packages/Keyguard/res/drawable-xxhdpi/scrubber_control_focused_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xxhdpi/scrubber_control_normal_holo.png b/packages/Keyguard/res/drawable-xxhdpi/scrubber_control_normal_holo.png
deleted file mode 100644
index 6f696fd..0000000
--- a/packages/Keyguard/res/drawable-xxhdpi/scrubber_control_normal_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xxhdpi/scrubber_control_pressed_holo.png b/packages/Keyguard/res/drawable-xxhdpi/scrubber_control_pressed_holo.png
deleted file mode 100644
index faae4e3..0000000
--- a/packages/Keyguard/res/drawable-xxhdpi/scrubber_control_pressed_holo.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xxhdpi/scrubber_primary_holo.9.png b/packages/Keyguard/res/drawable-xxhdpi/scrubber_primary_holo.9.png
deleted file mode 100644
index 82c2b7e..0000000
--- a/packages/Keyguard/res/drawable-xxhdpi/scrubber_primary_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xxhdpi/scrubber_secondary_holo.9.png b/packages/Keyguard/res/drawable-xxhdpi/scrubber_secondary_holo.9.png
deleted file mode 100644
index 800d95e..0000000
--- a/packages/Keyguard/res/drawable-xxhdpi/scrubber_secondary_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xxhdpi/scrubber_track_holo_light.9.png b/packages/Keyguard/res/drawable-xxhdpi/scrubber_track_holo_light.9.png
deleted file mode 100644
index 9991f7f..0000000
--- a/packages/Keyguard/res/drawable-xxhdpi/scrubber_track_holo_light.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable/ic_lockscreen_camera.xml b/packages/Keyguard/res/drawable/ic_lockscreen_camera.xml
deleted file mode 100644
index 41277fe..0000000
--- a/packages/Keyguard/res/drawable/ic_lockscreen_camera.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_camera_normal" />
-
- <item
- android:state_enabled="true"
- android:state_active="true"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_camera_activated" />
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="true"
- android:drawable="@drawable/ic_lockscreen_camera_activated" />
-
-</selector>
diff --git a/packages/Keyguard/res/drawable/ic_lockscreen_handle.xml b/packages/Keyguard/res/drawable/ic_lockscreen_handle.xml
deleted file mode 100644
index e7b4a6e..0000000
--- a/packages/Keyguard/res/drawable/ic_lockscreen_handle.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_handle_normal" />
-
- <item
- android:state_enabled="true"
- android:state_active="true"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_handle_pressed" />
-
-</selector>
diff --git a/packages/Keyguard/res/drawable/ic_lockscreen_outerring.xml b/packages/Keyguard/res/drawable/ic_lockscreen_outerring.xml
deleted file mode 100644
index 75bea70..0000000
--- a/packages/Keyguard/res/drawable/ic_lockscreen_outerring.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="oval"
- >
- <size android:height="@dimen/keyguard_lockscreen_outerring_diameter"
- android:width="@dimen/keyguard_lockscreen_outerring_diameter" />
- <solid android:color="#00000000" />
- <stroke android:color="#1affffff" android:width="2dp" />
-</shape>
diff --git a/packages/Keyguard/res/drawable/ic_lockscreen_silent.xml b/packages/Keyguard/res/drawable/ic_lockscreen_silent.xml
deleted file mode 100644
index df23278..0000000
--- a/packages/Keyguard/res/drawable/ic_lockscreen_silent.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_silent_normal" />
-
- <item
- android:state_enabled="true"
- android:state_active="true"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_silent_activated" />
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="true"
- android:drawable="@drawable/ic_lockscreen_silent_activated" />
-
-</selector>
diff --git a/packages/Keyguard/res/drawable/ic_lockscreen_soundon.xml b/packages/Keyguard/res/drawable/ic_lockscreen_soundon.xml
deleted file mode 100644
index b44c86c..0000000
--- a/packages/Keyguard/res/drawable/ic_lockscreen_soundon.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_soundon_normal" />
-
- <item
- android:state_enabled="true"
- android:state_active="true"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_soundon_activated" />
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="true"
- android:drawable="@drawable/ic_lockscreen_soundon_activated" />
-
-</selector>
diff --git a/packages/Keyguard/res/drawable/ic_lockscreen_unlock.xml b/packages/Keyguard/res/drawable/ic_lockscreen_unlock.xml
deleted file mode 100644
index bb1d0ee..0000000
--- a/packages/Keyguard/res/drawable/ic_lockscreen_unlock.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_unlock_normal" />
-
- <item
- android:state_enabled="true"
- android:state_active="true"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_unlock_activated" />
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="true"
- android:drawable="@drawable/ic_lockscreen_unlock_activated" />
-
-</selector>
diff --git a/packages/Keyguard/res/drawable/ic_lockscreen_unlock_phantom.xml b/packages/Keyguard/res/drawable/ic_lockscreen_unlock_phantom.xml
deleted file mode 100644
index 83f0aed..0000000
--- a/packages/Keyguard/res/drawable/ic_lockscreen_unlock_phantom.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="false"
- android:drawable="@color/transparent" />
-
- <item
- android:state_enabled="true"
- android:state_active="true"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_unlock_activated" />
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="true"
- android:drawable="@drawable/ic_lockscreen_unlock_activated" />
-
-</selector>
diff --git a/packages/Keyguard/res/drawable/keyguard_add_widget_button.xml b/packages/Keyguard/res/drawable/keyguard_add_widget_button.xml
deleted file mode 100644
index c26f81d..0000000
--- a/packages/Keyguard/res/drawable/keyguard_add_widget_button.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true" android:drawable="@drawable/kg_add_widget_pressed" />
- <item android:state_enabled="false" android:drawable="@drawable/kg_add_widget_disabled" />
- <item android:drawable="@drawable/kg_add_widget" />
-</selector>
diff --git a/packages/Keyguard/res/drawable/keyguard_expand_challenge_handle.xml b/packages/Keyguard/res/drawable/keyguard_expand_challenge_handle.xml
deleted file mode 100644
index 3e0780b..0000000
--- a/packages/Keyguard/res/drawable/keyguard_expand_challenge_handle.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_focused="true" android:drawable="@drawable/kg_security_lock_focused" />
- <item android:state_pressed="true" android:drawable="@drawable/kg_security_lock_pressed" />
- <item android:drawable="@drawable/kg_security_lock_normal" />
-</selector>
diff --git a/packages/Keyguard/res/drawable/lockscreen_emergency_button.xml b/packages/Keyguard/res/drawable/lockscreen_emergency_button.xml
deleted file mode 100644
index 4ec6a96..0000000
--- a/packages/Keyguard/res/drawable/lockscreen_emergency_button.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_enabled="true" android:drawable="@drawable/ic_lockscreen_emergencycall_normal" />
- <item android:state_pressed="true" android:drawable="@drawable/ic_lockscreen_emergencycall_pressed" />
- <item android:drawable="@drawable/ic_lockscreen_emergencycall_normal" />
-</selector>
diff --git a/packages/Keyguard/res/drawable/scrubber_control_selector_holo.xml b/packages/Keyguard/res/drawable/scrubber_control_selector_holo.xml
deleted file mode 100644
index d09b1a5..0000000
--- a/packages/Keyguard/res/drawable/scrubber_control_selector_holo.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_enabled="false" android:drawable="@drawable/scrubber_control_disabled_holo" />
- <item android:state_pressed="true" android:drawable="@drawable/scrubber_control_pressed_holo" />
- <item android:state_selected="true" android:drawable="@drawable/scrubber_control_focused_holo" />
- <item android:drawable="@drawable/scrubber_control_normal_holo" />
-</selector>
diff --git a/packages/Keyguard/res/drawable/scrubber_progress_horizontal_holo_light.xml b/packages/Keyguard/res/drawable/scrubber_progress_horizontal_holo_light.xml
deleted file mode 100644
index f07c742..0000000
--- a/packages/Keyguard/res/drawable/scrubber_progress_horizontal_holo_light.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@android:id/background"
- android:drawable="@drawable/scrubber_track_holo_light" />
- <item android:id="@android:id/secondaryProgress">
- <scale android:scaleWidth="100%"
- android:drawable="@drawable/scrubber_secondary_holo" />
- </item>
- <item android:id="@android:id/progress">
- <scale android:scaleWidth="100%"
- android:drawable="@drawable/scrubber_primary_holo" />
- </item>
-</layer-list>
diff --git a/packages/Keyguard/res/layout-land/keyguard_host_view.xml b/packages/Keyguard/res/layout-land/keyguard_host_view.xml
deleted file mode 100644
index 891910e..0000000
--- a/packages/Keyguard/res/layout-land/keyguard_host_view.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License")
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<!-- This is the host view that generally contains two sub views: the widget view
- and the security view. -->
-<com.android.keyguard.KeyguardHostView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res-auto"
- android:id="@+id/keyguard_host_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal"
- android:clipChildren="false"
- android:clipToPadding="false">
-
- <com.android.keyguard.MultiPaneChallengeLayout
- android:id="@+id/multi_pane_challenge"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal"
- android:clipChildren="false"
- android:clipToPadding="false">
-
- <include layout="@layout/keyguard_widget_remove_drop_target"
- android:id="@+id/keyguard_widget_pager_delete_target"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="top|center_horizontal"
- androidprv:layout_childType="pageDeleteDropTarget" />
-
- <include layout="@layout/keyguard_widget_pager"
- android:id="@+id/app_widget_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- androidprv:layout_centerWithinArea="0.55"
- androidprv:layout_childType="widget"
- androidprv:layout_maxWidth="480dp"
- androidprv:layout_maxHeight="480dp" />
- <include layout="@layout/keyguard_multi_user_selector"/>
-
- <View android:layout_width="match_parent"
- android:layout_height="match_parent"
- androidprv:layout_childType="scrim"
- android:background="#99000000" />
-
- <com.android.keyguard.KeyguardSecurityContainer
- android:id="@+id/keyguard_security_container"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:clipChildren="false"
- android:clipToPadding="false"
- androidprv:layout_childType="challenge"
- androidprv:layout_centerWithinArea="0.55">
- <com.android.keyguard.KeyguardSecurityViewFlipper
- android:id="@+id/view_flipper"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:clipChildren="false"
- android:clipToPadding="false"
- android:paddingLeft="@dimen/keyguard_security_view_margin"
- android:paddingTop="@dimen/keyguard_security_view_margin"
- android:paddingRight="@dimen/keyguard_security_view_margin"
- android:paddingBottom="@dimen/keyguard_security_view_margin"
- android:gravity="center">
- </com.android.keyguard.KeyguardSecurityViewFlipper>
- </com.android.keyguard.KeyguardSecurityContainer>
-
- </com.android.keyguard.MultiPaneChallengeLayout>
-</com.android.keyguard.KeyguardHostView>
-
diff --git a/packages/Keyguard/res/layout-land/keyguard_widget_pager.xml b/packages/Keyguard/res/layout-land/keyguard_widget_pager.xml
deleted file mode 100644
index 50c2709..0000000
--- a/packages/Keyguard/res/layout-land/keyguard_widget_pager.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License")
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<!-- This is the selector widget that allows the user to select an action. -->
-<com.android.keyguard.KeyguardWidgetCarousel
- xmlns:androidprv="http://schemas.android.com/apk/res-auto"
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:paddingLeft="25dp"
- android:paddingRight="25dp"
- android:paddingTop="25dp"
- android:paddingBottom="25dp"
- android:clipToPadding="false"
- androidprv:pageSpacing="10dp">
-</com.android.keyguard.KeyguardWidgetCarousel>
diff --git a/packages/Keyguard/res/layout-port/keyguard_host_view.xml b/packages/Keyguard/res/layout-port/keyguard_host_view.xml
deleted file mode 100644
index 1b8820b..0000000
--- a/packages/Keyguard/res/layout-port/keyguard_host_view.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License")
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<!-- This is the host view that generally contains two sub views: the widget view
- and the security view. -->
-<com.android.keyguard.KeyguardHostView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res-auto"
- android:id="@+id/keyguard_host_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center_horizontal"
- android:clipChildren="false"
- android:clipToPadding="false"
- android:orientation="vertical">
-
- <com.android.keyguard.SlidingChallengeLayout
- android:id="@+id/sliding_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:clipChildren="false"
- android:clipToPadding="false">
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- androidprv:layout_childType="pageDeleteDropTarget">
- <include layout="@layout/keyguard_widget_remove_drop_target"
- android:id="@+id/keyguard_widget_pager_delete_target"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="top|center_horizontal" />
- </FrameLayout>
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- androidprv:layout_childType="widgets">
- <include layout="@layout/keyguard_widget_pager"
- android:id="@+id/app_widget_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center"/>
- </FrameLayout>
-
- <View android:layout_width="match_parent"
- android:layout_height="match_parent"
- androidprv:layout_childType="scrim"
- android:background="#99000000" />
-
- <com.android.keyguard.KeyguardSecurityContainer
- android:id="@+id/keyguard_security_container"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:clipChildren="false"
- android:clipToPadding="false"
- androidprv:layout_maxHeight="@dimen/keyguard_security_height"
- androidprv:layout_childType="challenge"
- android:padding="0dp"
- android:gravity="bottom|center_horizontal">
- <com.android.keyguard.KeyguardSecurityViewFlipper
- android:id="@+id/view_flipper"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:clipChildren="false"
- android:clipToPadding="false"
- android:paddingTop="@dimen/keyguard_security_view_margin"
- android:gravity="center">
- </com.android.keyguard.KeyguardSecurityViewFlipper>
- </com.android.keyguard.KeyguardSecurityContainer>
-
- <ImageButton
- android:layout_width="match_parent"
- android:layout_height="@dimen/kg_widget_pager_bottom_padding"
- androidprv:layout_childType="expandChallengeHandle"
- android:focusable="true"
- android:background="@null"
- android:src="@drawable/keyguard_expand_challenge_handle"
- android:scaleType="center"
- android:contentDescription="@string/keyguard_accessibility_expand_lock_area" />
-
- </com.android.keyguard.SlidingChallengeLayout>
-</com.android.keyguard.KeyguardHostView>
-
diff --git a/packages/Keyguard/res/layout-port/keyguard_widget_pager.xml b/packages/Keyguard/res/layout-port/keyguard_widget_pager.xml
deleted file mode 100644
index 6d7d864..0000000
--- a/packages/Keyguard/res/layout-port/keyguard_widget_pager.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License")
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<!-- This is the selector widget that allows the user to select an action. -->
-<com.android.keyguard.KeyguardWidgetPager
- xmlns:androidprv="http://schemas.android.com/apk/res-auto"
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/app_widget_container"
- android:paddingLeft="25dp"
- android:paddingRight="25dp"
- android:paddingTop="25dp"
- android:paddingBottom="@dimen/kg_widget_pager_bottom_padding"
- android:clipToPadding="false"
- androidprv:pageSpacing="10dp">
-</com.android.keyguard.KeyguardWidgetPager>
diff --git a/packages/Keyguard/res/layout-sw600dp-port/keyguard_host_view.xml b/packages/Keyguard/res/layout-sw600dp-port/keyguard_host_view.xml
deleted file mode 100644
index f2f3981..0000000
--- a/packages/Keyguard/res/layout-sw600dp-port/keyguard_host_view.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License")
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<!-- This is the host view that generally contains two sub views: the widget view
- and the security view. -->
-<com.android.keyguard.KeyguardHostView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res-auto"
- android:id="@+id/keyguard_host_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal"
- android:clipChildren="false"
- android:clipToPadding="false">
-
- <com.android.keyguard.MultiPaneChallengeLayout
- android:id="@+id/multi_pane_challenge"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:clipChildren="false"
- android:clipToPadding="false"
- android:orientation="vertical">
-
- <include layout="@layout/keyguard_widget_remove_drop_target"
- android:id="@+id/keyguard_widget_pager_delete_target"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="top|center_horizontal"
- androidprv:layout_childType="pageDeleteDropTarget" />
-
- <include layout="@layout/keyguard_widget_pager"
- android:id="@+id/app_widget_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- androidprv:layout_centerWithinArea="0.5"
- androidprv:layout_childType="widget"
- androidprv:layout_maxWidth="480dp"
- androidprv:layout_maxHeight="480dp" />
-
- <include layout="@layout/keyguard_multi_user_selector"/>
-
- <View android:layout_width="match_parent"
- android:layout_height="match_parent"
- androidprv:layout_childType="scrim"
- android:background="#99000000" />
-
- <com.android.keyguard.KeyguardSecurityContainer
- android:id="@+id/keyguard_security_container"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:clipChildren="false"
- android:clipToPadding="false"
- androidprv:layout_centerWithinArea="0.5"
- androidprv:layout_childType="challenge"
- android:layout_gravity="center_horizontal|bottom">
- <com.android.keyguard.KeyguardSecurityViewFlipper
- android:id="@+id/view_flipper"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:clipChildren="false"
- android:clipToPadding="false"
- android:paddingLeft="@dimen/keyguard_security_view_margin"
- android:paddingTop="@dimen/keyguard_security_view_margin"
- android:paddingRight="@dimen/keyguard_security_view_margin"
- android:paddingBottom="@dimen/keyguard_security_view_margin"
- android:gravity="center">
- </com.android.keyguard.KeyguardSecurityViewFlipper>
- </com.android.keyguard.KeyguardSecurityContainer>
-
- </com.android.keyguard.MultiPaneChallengeLayout>
-</com.android.keyguard.KeyguardHostView>
diff --git a/packages/Keyguard/res/layout-sw600dp/keyguard_glow_pad_container.xml b/packages/Keyguard/res/layout-sw600dp/keyguard_glow_pad_container.xml
deleted file mode 100644
index 930b14e..0000000
--- a/packages/Keyguard/res/layout-sw600dp/keyguard_glow_pad_container.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License")
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
- <include layout="@layout/keyguard_glow_pad_view"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center" />
-</merge>
\ No newline at end of file
diff --git a/packages/Keyguard/res/layout/keyguard_account_view.xml b/packages/Keyguard/res/layout/keyguard_account_view.xml
deleted file mode 100644
index bde2ec6..0000000
--- a/packages/Keyguard/res/layout/keyguard_account_view.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License")
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<com.android.keyguard.KeyguardAccountView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res-auto"
- android:id="@+id/keyguard_account_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- androidprv:layout_maxWidth="@dimen/keyguard_security_width"
- androidprv:layout_maxHeight="@dimen/keyguard_security_height"
- android:orientation="vertical">
-
- <include layout="@layout/keyguard_message_area"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1">
-
- <EditText
- android:id="@+id/login"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="8dip"
- android:layout_marginStart="7dip"
- android:layout_marginEnd="7dip"
- android:layout_alignParentTop="true"
- android:hint="@string/kg_login_username_hint"
- android:inputType="textEmailAddress"
- />
-
- <EditText
- android:id="@+id/password"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/login"
- android:layout_toLeftOf="@+id/ok"
- android:layout_marginTop="15dip"
- android:layout_marginStart="7dip"
- android:layout_marginEnd="7dip"
- android:inputType="textPassword"
- android:hint="@string/kg_login_password_hint"
- android:nextFocusRight="@+id/ok"
- android:nextFocusDown="@+id/ok"
- />
-
- <!-- ok below password, aligned to right of screen -->
- <Button
- android:id="@+id/ok"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_margin="7dip"
- android:layout_alignParentEnd="true"
- android:layout_below="@id/login"
- android:text="@string/kg_login_submit_button"
- />
-
- </RelativeLayout>
-
- <!-- no room for ECA on this screen right now
- <include layout="@layout/keyguard_eca"
- android:id="@+id/keyguard_selector_fade_container"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_gravity="bottom|center_horizontal"
- android:gravity="center_horizontal" />
- -->
-
-</com.android.keyguard.KeyguardAccountView>
diff --git a/packages/Keyguard/res/layout/keyguard_add_widget.xml b/packages/Keyguard/res/layout/keyguard_add_widget.xml
deleted file mode 100644
index 01b616c..0000000
--- a/packages/Keyguard/res/layout/keyguard_add_widget.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2009, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License")
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<!-- This is a view that shows general status information in Keyguard. -->
-<com.android.keyguard.KeyguardWidgetFrame
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/keyguard_add_widget"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- >
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:contentDescription="@string/keyguard_accessibility_widget_empty_slot"
- >
- <ImageView
- android:id="@+id/keyguard_add_widget_view"
- android:clickable="true"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:padding="24dp"
- android:src="@drawable/keyguard_add_widget_button"
- android:contentDescription="@string/keyguard_accessibility_add_widget"/>
- </FrameLayout>
-</com.android.keyguard.KeyguardWidgetFrame>
diff --git a/packages/Keyguard/res/layout/keyguard_bouncer.xml b/packages/Keyguard/res/layout/keyguard_bouncer.xml
index 296efb3..8c80e78 100644
--- a/packages/Keyguard/res/layout/keyguard_bouncer.xml
+++ b/packages/Keyguard/res/layout/keyguard_bouncer.xml
@@ -24,7 +24,7 @@
<include
style="@style/BouncerSecurityContainer"
- layout="@layout/keyguard_simple_host_view"
+ layout="@layout/keyguard_host_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</FrameLayout>
diff --git a/packages/Keyguard/res/layout/keyguard_emergency_carrier_area.xml b/packages/Keyguard/res/layout/keyguard_emergency_carrier_area.xml
index a083f89..7e09a5b 100644
--- a/packages/Keyguard/res/layout/keyguard_emergency_carrier_area.xml
+++ b/packages/Keyguard/res/layout/keyguard_emergency_carrier_area.xml
@@ -46,13 +46,11 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="@dimen/eca_overlap"
- android:drawableLeft="@drawable/lockscreen_emergency_button"
android:text="@string/kg_emergency_call_label"
style="?android:attr/buttonBarButtonStyle"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="@dimen/kg_status_line_font_size"
android:textColor="?android:attr/textColorSecondary"
- android:drawablePadding="8dip"
android:textAllCaps="@bool/kg_use_all_caps" />
</com.android.keyguard.EmergencyCarrierArea>
diff --git a/packages/Keyguard/res/layout/keyguard_face_unlock_view.xml b/packages/Keyguard/res/layout/keyguard_face_unlock_view.xml
deleted file mode 100644
index 0c85dab..0000000
--- a/packages/Keyguard/res/layout/keyguard_face_unlock_view.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License")
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<!-- This is the screen that allows the user to unlock by showing their face. -->
-<com.android.keyguard.KeyguardFaceUnlockView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res-auto"
- android:id="@+id/keyguard_face_unlock_view"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- androidprv:layout_maxWidth="@dimen/keyguard_security_width"
- androidprv:layout_maxHeight="@dimen/keyguard_security_height"
- android:contentDescription="@string/keyguard_accessibility_face_unlock">
-
- <include layout="@layout/keyguard_message_area"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- />
-
- <FrameLayout
- android:id="@+id/keyguard_bouncer_frame"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1"
- >
- <com.android.internal.widget.FaceUnlockView
- android:id="@+id/face_unlock_area_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center_horizontal"
- android:background="@drawable/intro_bg"
- android:gravity="center">
-
- <View
- android:id="@+id/spotlightMask"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/facelock_spotlight_mask"
- />
-
- <ImageButton
- android:id="@+id/face_unlock_cancel_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="5dip"
- android:layout_alignParentTop="true"
- android:layout_alignParentEnd="true"
- android:background="#00000000"
- android:src="@drawable/ic_facial_backup"
- />
- </com.android.internal.widget.FaceUnlockView>
- </FrameLayout>
-
- <include layout="@layout/keyguard_eca"
- android:id="@+id/keyguard_selector_fade_container"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_gravity="bottom|center_horizontal"
- android:gravity="center_horizontal" />
-</com.android.keyguard.KeyguardFaceUnlockView>
diff --git a/packages/Keyguard/res/layout/keyguard_glow_pad_container.xml b/packages/Keyguard/res/layout/keyguard_glow_pad_container.xml
deleted file mode 100644
index 07953b4..0000000
--- a/packages/Keyguard/res/layout/keyguard_glow_pad_container.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License")
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
- <include layout="@layout/keyguard_glow_pad_view"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom|center_horizontal"
- android:layout_marginBottom="@dimen/glowpadcontainer_bottom_margin"/>
-</merge>
diff --git a/packages/Keyguard/res/layout/keyguard_glow_pad_view.xml b/packages/Keyguard/res/layout/keyguard_glow_pad_view.xml
deleted file mode 100644
index 2432336..0000000
--- a/packages/Keyguard/res/layout/keyguard_glow_pad_view.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License")
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<!-- This is the selector widget that allows the user to select an action. -->
-<com.android.internal.widget.multiwaveview.GlowPadView
- xmlns:prvandroid="http://schemas.android.com/apk/prv/res/android"
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/glow_pad_view"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:orientation="horizontal"
- android:gravity="@integer/kg_selector_gravity"
- android:contentDescription="@string/keyguard_accessibility_slide_area"
- prvandroid:handleDrawable="@drawable/ic_lockscreen_handle"
- prvandroid:outerRingDrawable="@drawable/ic_lockscreen_outerring"
- prvandroid:outerRadius="@dimen/glowpadview_target_placement_radius"
- prvandroid:innerRadius="@dimen/glowpadview_inner_radius"
- prvandroid:snapMargin="@dimen/glowpadview_snap_margin"
- prvandroid:firstItemOffset="@integer/kg_glowpad_rotation_offset"
- prvandroid:magneticTargets="true"
- prvandroid:feedbackCount="1"
- prvandroid:vibrationDuration="20"
- prvandroid:glowRadius="@dimen/glowpadview_glow_radius"
- prvandroid:pointDrawable="@drawable/ic_lockscreen_glowdot"
- prvandroid:allowScaling="true" />
diff --git a/packages/Keyguard/res/layout/keyguard_simple_host_view.xml b/packages/Keyguard/res/layout/keyguard_host_view.xml
similarity index 95%
rename from packages/Keyguard/res/layout/keyguard_simple_host_view.xml
rename to packages/Keyguard/res/layout/keyguard_host_view.xml
index 28ce265..3635aff 100644
--- a/packages/Keyguard/res/layout/keyguard_simple_host_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_host_view.xml
@@ -19,7 +19,7 @@
<!-- This is the host view that generally contains two sub views: the widget view
and the security view. -->
-<com.android.keyguard.KeyguardSimpleHostView
+<com.android.keyguard.KeyguardHostView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:id="@+id/keyguard_host_view"
@@ -48,5 +48,5 @@
</com.android.keyguard.KeyguardSecurityViewFlipper>
</com.android.keyguard.KeyguardSecurityContainer>
-</com.android.keyguard.KeyguardSimpleHostView>
+</com.android.keyguard.KeyguardHostView>
diff --git a/packages/Keyguard/res/layout/keyguard_multi_user_avatar.xml b/packages/Keyguard/res/layout/keyguard_multi_user_avatar.xml
deleted file mode 100644
index 41b0be9..0000000
--- a/packages/Keyguard/res/layout/keyguard_multi_user_avatar.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2009, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License")
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<!-- This is a view that shows general status information in Keyguard. -->
-<com.android.keyguard.KeyguardMultiUserAvatar
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="@dimen/keyguard_avatar_size"
- android:layout_height="@dimen/keyguard_avatar_size"
- android:background="#00000000"
- android:gravity="center_horizontal">
- <ImageView
- android:id="@+id/keyguard_user_avatar"
- android:scaleType="center"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center"/>
- <TextView
- android:id="@+id/keyguard_user_name"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom"
- android:gravity="center"
- android:textSize="@dimen/keyguard_avatar_name_size"
- android:textColor="#ffffff"
- android:singleLine="true"
- android:ellipsize="end"
- android:paddingLeft="2dp"
- android:paddingRight="2dp" />
-</com.android.keyguard.KeyguardMultiUserAvatar>
diff --git a/packages/Keyguard/res/layout/keyguard_multi_user_selector.xml b/packages/Keyguard/res/layout/keyguard_multi_user_selector.xml
deleted file mode 100644
index 83036ab..0000000
--- a/packages/Keyguard/res/layout/keyguard_multi_user_selector.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2009, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License")
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<com.android.keyguard.KeyguardMultiUserSelectorView
- xmlns:androidprv="http://schemas.android.com/apk/res-auto"
- xmlns:android="http://schemas.android.com/apk/res/android"
- androidprv:layout_childType="userSwitcher"
- android:id="@+id/keyguard_user_selector"
- android:orientation="horizontal"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom"
- android:contentDescription="@string/keyguard_accessibility_user_selector"
- android:visibility="gone">
-
- <com.android.keyguard.KeyguardLinearLayout
- android:id="@+id/keyguard_users_grid"
- android:orientation="horizontal"
- android:layout_width="wrap_content"
- android:layout_marginBottom="@dimen/keyguard_muliuser_selector_margin"
- android:layout_height="@dimen/keyguard_avatar_size"
- android:layout_gravity="center|bottom" />
-
-</com.android.keyguard.KeyguardMultiUserSelectorView>
diff --git a/packages/Keyguard/res/layout/keyguard_password_view.xml b/packages/Keyguard/res/layout/keyguard_password_view.xml
index b7d5d30..cff2fc7 100644
--- a/packages/Keyguard/res/layout/keyguard_password_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_password_view.xml
@@ -41,7 +41,6 @@
<!-- Password entry field -->
<FrameLayout
- android:id="@+id/keyguard_bouncer_frame"
android:layout_height="wrap_content"
android:layout_width="280dp"
android:layout_gravity="center_horizontal"
diff --git a/packages/Keyguard/res/layout/keyguard_pattern_view.xml b/packages/Keyguard/res/layout/keyguard_pattern_view.xml
index 1fb0420..61480650 100644
--- a/packages/Keyguard/res/layout/keyguard_pattern_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_pattern_view.xml
@@ -41,6 +41,7 @@
android:clipToPadding="false">
<LinearLayout
+ android:id="@+id/container"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="vertical"
@@ -53,18 +54,10 @@
android:layout_height="wrap_content"
/>
- <FrameLayout
- android:id="@+id/keyguard_bouncer_frame"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1"
- android:clipChildren="false"
- android:clipToPadding="false"
- >
<com.android.internal.widget.LockPatternView
android:id="@+id/lockPatternView"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginEnd="8dip"
android:layout_marginBottom="4dip"
@@ -74,7 +67,7 @@
android:contentDescription="@string/keyguard_accessibility_pattern_area"
android:clipChildren="false"
android:clipToPadding="false" />
- </FrameLayout>
+
<include layout="@layout/keyguard_eca"
android:id="@+id/keyguard_selector_fade_container"
android:layout_width="match_parent"
diff --git a/packages/Keyguard/res/layout/keyguard_pin_view.xml b/packages/Keyguard/res/layout/keyguard_pin_view.xml
index 2e7464b..d3fb982 100644
--- a/packages/Keyguard/res/layout/keyguard_pin_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_pin_view.xml
@@ -33,7 +33,7 @@
android:layout_height="wrap_content"
/>
<LinearLayout
- android:id="@+id/keyguard_bouncer_frame"
+ android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
diff --git a/packages/Keyguard/res/layout/keyguard_selector_view.xml b/packages/Keyguard/res/layout/keyguard_selector_view.xml
deleted file mode 100644
index 5330363..0000000
--- a/packages/Keyguard/res/layout/keyguard_selector_view.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License")
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<!-- This is the selector widget that allows the user to select an action. -->
-<com.android.keyguard.KeyguardSelectorView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res-auto"
- android:id="@+id/keyguard_selector_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- androidprv:layout_maxWidth="420dp"
- androidprv:layout_maxHeight="@dimen/keyguard_security_height"
- android:clipChildren="false"
- android:clipToPadding="false"
- android:orientation="vertical"
- android:contentDescription="@string/keyguard_accessibility_slide_unlock">
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center"
- android:clipChildren="false"
- android:clipToPadding="false"
- android:gravity="center">
-
- <include layout="@layout/keyguard_message_area"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <View
- android:id="@+id/keyguard_selector_view_frame"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginLeft="16dp"
- android:layout_marginRight="16dp"/>
-
- <include layout="@layout/keyguard_glow_pad_container" />
-
- <include layout="@layout/keyguard_eca"
- android:id="@+id/keyguard_selector_fade_container"
- android:layout_width="match_parent"
- android:layout_height="48dp"
- android:layout_gravity="bottom|center_horizontal" />
- </FrameLayout>
-
-</com.android.keyguard.KeyguardSelectorView>
-
diff --git a/packages/Keyguard/res/layout/keyguard_sim_pin_view.xml b/packages/Keyguard/res/layout/keyguard_sim_pin_view.xml
index 929fa09..b0a93e6 100644
--- a/packages/Keyguard/res/layout/keyguard_sim_pin_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_sim_pin_view.xml
@@ -39,7 +39,6 @@
android:layout_height="wrap_content"
/>
<LinearLayout
- android:id="@+id/keyguard_bouncer_frame"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
diff --git a/packages/Keyguard/res/layout/keyguard_sim_puk_view.xml b/packages/Keyguard/res/layout/keyguard_sim_puk_view.xml
index 0cf802d..cf41bd3 100644
--- a/packages/Keyguard/res/layout/keyguard_sim_puk_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_sim_puk_view.xml
@@ -40,7 +40,6 @@
android:layout_height="wrap_content"
/>
<LinearLayout
- android:id="@+id/keyguard_bouncer_frame"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
diff --git a/packages/Keyguard/res/layout/keyguard_transport_control_view.xml b/packages/Keyguard/res/layout/keyguard_transport_control_view.xml
deleted file mode 100644
index da82e40..0000000
--- a/packages/Keyguard/res/layout/keyguard_transport_control_view.xml
+++ /dev/null
@@ -1,151 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- This is a view to control music playback in keyguard. -->
-<com.android.keyguard.KeyguardTransportControlView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:id="@+id/keyguard_transport_control">
-
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="top"
- android:gravity="center">
- <ImageView
- android:id="@+id/badge"
- android:layout_width="32dp"
- android:layout_height="32dp"
- android:scaleType="fitCenter" />
- <FrameLayout
- android:id="@+id/info_container"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
- <LinearLayout
- android:id="@+id/metadata_container"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center">
- <TextView
- android:id="@+id/title"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="16dip"
- android:layout_marginEnd="16dip"
- android:gravity="center_horizontal"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:fontFamily="sans-serif-light" />
- <TextView
- android:id="@+id/artist_album"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="16dip"
- android:layout_marginEnd="16dip"
- android:gravity="center_horizontal"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:attr/textColorSecondary" />
- </LinearLayout>
- <RelativeLayout
- android:id="@+id/transient_seek"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:visibility="invisible">
- <SeekBar
- android:id="@+id/transient_seek_bar"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- style="@style/Widget.TransportControl.SeekBar" />
- <TextView
- android:id="@+id/transient_seek_time_elapsed"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentStart="true"
- android:layout_below="@id/transient_seek_bar"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textSize="12dp" />
- <TextView
- android:id="@+id/transient_seek_time_remaining"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentEnd="true"
- android:layout_below="@id/transient_seek_bar"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textSize="12dp" />
- </RelativeLayout>
- </FrameLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="4dp"
- android:orientation="horizontal">
- <FrameLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1">
- <ImageButton
- android:id="@+id/btn_prev"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:src="@drawable/ic_media_previous"
- android:background="?android:attr/selectableItemBackground"
- android:minWidth="48dp"
- android:minHeight="48dp"
- android:contentDescription="@string/keyguard_accessibility_transport_prev_description"/>
- </FrameLayout>
- <FrameLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1">
- <ImageButton
- android:id="@+id/btn_play"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:src="@drawable/ic_media_play"
- android:background="?android:attr/selectableItemBackground"
- android:minWidth="48dp"
- android:minHeight="48dp"
- android:contentDescription="@string/keyguard_accessibility_transport_play_description"/>
- </FrameLayout>
- <FrameLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1">
- <ImageButton
- android:id="@+id/btn_next"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:src="@drawable/ic_media_next"
- android:background="?android:attr/selectableItemBackground"
- android:minWidth="48dp"
- android:minHeight="48dp"
- android:contentDescription="@string/keyguard_accessibility_transport_next_description"/>
- </FrameLayout>
- </LinearLayout>
- </LinearLayout>
-
-</com.android.keyguard.KeyguardTransportControlView>
diff --git a/packages/Keyguard/res/layout/keyguard_widget_remove_drop_target.xml b/packages/Keyguard/res/layout/keyguard_widget_remove_drop_target.xml
deleted file mode 100644
index 58b5b27..0000000
--- a/packages/Keyguard/res/layout/keyguard_widget_remove_drop_target.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License")
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<TextView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:gravity="center"
- android:padding="30dp"
- android:paddingLeft="60dp"
- android:paddingRight="60dp"
- android:drawableLeft="@drawable/kg_widget_delete_drop_target"
- android:drawablePadding="4dp"
- android:text="@string/kg_reordering_delete_drop_target_text"
- android:textColor="#FFF"
- android:textSize="12dp"
- android:shadowColor="#000"
- android:shadowDy="1.0"
- android:shadowRadius="1.0"
- android:visibility="gone" />
diff --git a/packages/Keyguard/res/values-land/bools.xml b/packages/Keyguard/res/values-land/bools.xml
index a1dd2e4..bedf504 100644
--- a/packages/Keyguard/res/values-land/bools.xml
+++ b/packages/Keyguard/res/values-land/bools.xml
@@ -15,8 +15,5 @@
-->
<resources>
- <bool name="kg_enable_camera_default_widget">false</bool>
- <bool name="kg_top_align_page_shrink_on_bouncer_visible">true</bool>
- <bool name="kg_share_status_area">false</bool>
<bool name="kg_sim_puk_account_full_screen">false</bool>
</resources>
diff --git a/packages/Keyguard/res/values-land/dimens.xml b/packages/Keyguard/res/values-land/dimens.xml
deleted file mode 100644
index bf30332..0000000
--- a/packages/Keyguard/res/values-land/dimens.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2010, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<resources>
- <!-- Shift emergency button from the left edge by this amount. Used by landscape layout on
- phones -->
- <dimen name="kg_emergency_button_shift">30dp</dimen>
-
- <!-- Space reserved at the bottom of secure views (pin/pattern/password/SIM pin/SIM puk) -->
- <dimen name="kg_secure_padding_height">0dp</dimen>
-
- <!-- Top padding for the widget pager -->
- <dimen name="kg_widget_pager_top_padding">0dp</dimen>
-
- <!-- Bottom padding for the widget pager -->
- <dimen name="kg_widget_pager_bottom_padding">0dp</dimen>
-
- <!-- If the height if keyguard drops below this threshold (most likely
- due to the appearance of the IME), then drop the multiuser selector.
- Landscape's layout allows this to be smaller than for portrait. -->
- <dimen name="kg_squashed_layout_threshold">400dp</dimen>
-
-</resources>
diff --git a/packages/Keyguard/res/values-land/integers.xml b/packages/Keyguard/res/values-land/integers.xml
index 020fd23..0739c3a 100644
--- a/packages/Keyguard/res/values-land/integers.xml
+++ b/packages/Keyguard/res/values-land/integers.xml
@@ -20,7 +20,4 @@
<!-- Gravity to make KeyguardSelectorView work in multiple orientations
0x13 == "left|center_vertical" -->
<integer name="kg_selector_gravity">0x13</integer>
- <integer name="kg_widget_region_weight">45</integer>
- <integer name="kg_security_flipper_weight">55</integer>
- <integer name="kg_glowpad_rotation_offset">-90</integer>
</resources>
diff --git a/packages/Keyguard/res/values-large/dimens.xml b/packages/Keyguard/res/values-large/dimens.xml
deleted file mode 100644
index 0b5d4ad..0000000
--- a/packages/Keyguard/res/values-large/dimens.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2011, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<resources>
- <!-- Minimum width of the search view text entry area. -->
- <dimen name="search_view_text_min_width">192dip</dimen>
-
- <item type="dimen" name="dialog_min_width_major">55%</item>
- <item type="dimen" name="dialog_min_width_minor">80%</item>
-
- <!-- Preference UI dimensions for larger screens. -->
- <dimen name="preference_widget_width">56dp</dimen>
-</resources>
diff --git a/packages/Keyguard/res/values-port/bools.xml b/packages/Keyguard/res/values-port/bools.xml
index 1e2a4f2..fdb8ebc 100644
--- a/packages/Keyguard/res/values-port/bools.xml
+++ b/packages/Keyguard/res/values-port/bools.xml
@@ -15,7 +15,5 @@
-->
<resources>
- <bool name="action_bar_embed_tabs">false</bool>
- <bool name="kg_share_status_area">true</bool>
<bool name="kg_sim_puk_account_full_screen">true</bool>
</resources>
diff --git a/packages/Keyguard/res/values-sw360dp/dimens.xml b/packages/Keyguard/res/values-sw360dp/dimens.xml
index 6e39a42..38658ca 100644
--- a/packages/Keyguard/res/values-sw360dp/dimens.xml
+++ b/packages/Keyguard/res/values-sw360dp/dimens.xml
@@ -22,8 +22,4 @@
<!-- Height of the sliding KeyguardSecurityContainer (includes 2x
keyguard_security_view_margin) -->
<dimen name="keyguard_security_height">400dp</dimen>
-
- <!-- The bottom margin for the GlowPadView container -->
- <dimen name="glowpadcontainer_bottom_margin">-48dp</dimen>
-
</resources>
diff --git a/packages/Keyguard/res/values-sw380dp-land/dimens.xml b/packages/Keyguard/res/values-sw380dp-land/dimens.xml
deleted file mode 100644
index 20eb1be..0000000
--- a/packages/Keyguard/res/values-sw380dp-land/dimens.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* //device/apps/common/assets/res/any/dimens.xml
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<resources>
- <!-- Top margin for the clock view -->
- <dimen name="kg_clock_top_margin">48dp</dimen>
-</resources>
diff --git a/packages/Keyguard/res/values-sw600dp-land/dimens.xml b/packages/Keyguard/res/values-sw600dp-land/dimens.xml
index 89252cf..a487644 100644
--- a/packages/Keyguard/res/values-sw600dp-land/dimens.xml
+++ b/packages/Keyguard/res/values-sw600dp-land/dimens.xml
@@ -18,11 +18,6 @@
*/
-->
<resources>
- <!-- Top margin for the clock view -->
- <dimen name="kg_clock_top_margin">85dp</dimen>
-
- <!-- Size of margin on the right of keyguard's status view -->
- <dimen name="kg_status_line_font_right_margin">16dp</dimen>
<!-- Overload default clock widget parameters -->
<dimen name="widget_big_font_size">100dp</dimen>
diff --git a/packages/Keyguard/res/values-sw600dp-land/integers.xml b/packages/Keyguard/res/values-sw600dp-land/integers.xml
deleted file mode 100644
index b724c90..0000000
--- a/packages/Keyguard/res/values-sw600dp-land/integers.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<resources>
- <integer name="kg_widget_region_weight">50</integer>
- <integer name="kg_security_flipper_weight">50</integer>
- <integer name="kg_glowpad_rotation_offset">0</integer>
-</resources>
diff --git a/packages/Keyguard/res/values-sw600dp-port/integers.xml b/packages/Keyguard/res/values-sw600dp-port/integers.xml
deleted file mode 100644
index 65b854a..0000000
--- a/packages/Keyguard/res/values-sw600dp-port/integers.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<resources>
- <integer name="kg_widget_region_weight">46</integer>
- <integer name="kg_security_flipper_weight">54</integer>
-</resources>
\ No newline at end of file
diff --git a/packages/Keyguard/res/values-sw600dp/bools.xml b/packages/Keyguard/res/values-sw600dp/bools.xml
index 00f45c1..654821a 100644
--- a/packages/Keyguard/res/values-sw600dp/bools.xml
+++ b/packages/Keyguard/res/values-sw600dp/bools.xml
@@ -15,12 +15,5 @@
-->
<resources>
- <bool name="target_honeycomb_needs_options_menu">false</bool>
- <bool name="show_ongoing_ime_switcher">true</bool>
- <bool name="kg_share_status_area">false</bool>
<bool name="kg_sim_puk_account_full_screen">false</bool>
- <!-- No camera for you, tablet user -->
- <bool name="kg_enable_camera_default_widget">false</bool>
- <bool name="kg_center_small_widgets_vertically">true</bool>
- <bool name="kg_top_align_page_shrink_on_bouncer_visible">false</bool>
</resources>
diff --git a/packages/Keyguard/res/values-sw600dp/dimens.xml b/packages/Keyguard/res/values-sw600dp/dimens.xml
index 74be1ff..5de1d11 100644
--- a/packages/Keyguard/res/values-sw600dp/dimens.xml
+++ b/packages/Keyguard/res/values-sw600dp/dimens.xml
@@ -18,50 +18,13 @@
*/
-->
<resources>
- <!-- Size of lockscreen outerring on unsecure unlock LockScreen -->
- <dimen name="keyguard_lockscreen_outerring_diameter">364dp</dimen>
-
- <!-- Height of FaceUnlock view in keyguard -->
- <dimen name="face_unlock_height">430dip</dimen>
-
- <!-- target placement radius for GlowPadView. Should be 1/2 of outerring diameter. -->
- <dimen name="glowpadview_target_placement_radius">182dip</dimen>
-
- <!-- Size of status line font in LockScreen. -->
- <dimen name="keyguard_pattern_unlock_status_line_font_size">14sp</dimen>
-
- <!-- Keyguard dimensions -->
- <!-- Size of the clock font in keyguard's status view -->
- <dimen name="kg_status_clock_font_size">120dp</dimen>
<!-- Size of the generic status lines keyguard's status view -->
<dimen name="kg_status_line_font_size">16sp</dimen>
- <!-- Top margin for the clock view -->
- <dimen name="kg_clock_top_margin">0dp</dimen>
-
- <!-- Size of margin on the right of keyguard's status view -->
- <dimen name="kg_status_line_font_right_margin">50dp</dimen>
-
- <!-- Horizontal padding for the widget pager -->
- <dimen name="kg_widget_pager_horizontal_padding">24dp</dimen>
-
- <!-- Top padding for the widget pager -->
- <dimen name="kg_widget_pager_top_padding">0dp</dimen>
-
- <!-- Bottom padding for the widget pager -->
- <dimen name="kg_widget_pager_bottom_padding">0dp</dimen>
-
- <!-- Top margin for the runway lights. We add a negative margin in large
- devices to account for the widget pager padding -->
- <dimen name="kg_runway_lights_top_margin">-10dp</dimen>
-
<!-- Margin around the various security views -->
<dimen name="keyguard_security_view_margin">12dp</dimen>
- <!-- Margin around the various security views -->
- <dimen name="keyguard_muliuser_selector_margin">12dp</dimen>
-
<!-- Overload default clock widget parameters -->
<dimen name="widget_big_font_size">140dp</dimen>
<dimen name="widget_label_font_size">16sp</dimen>
diff --git a/packages/Keyguard/res/values-sw600dp/integers.xml b/packages/Keyguard/res/values-sw600dp/integers.xml
deleted file mode 100644
index de9829c..0000000
--- a/packages/Keyguard/res/values-sw600dp/integers.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<resources>
- <integer name="kg_carousel_angle">60</integer>
-</resources>
diff --git a/packages/Keyguard/res/values-sw720dp-land/dimens.xml b/packages/Keyguard/res/values-sw720dp-land/dimens.xml
deleted file mode 100644
index 731bb64..0000000
--- a/packages/Keyguard/res/values-sw720dp-land/dimens.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* //device/apps/common/assets/res/any/dimens.xml
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<resources>
- <!-- Top margin for the clock view -->
- <dimen name="kg_clock_top_margin">174dp</dimen>
-
- <!-- Size of margin on the right of keyguard's status view -->
- <dimen name="kg_status_line_font_right_margin">16dp</dimen>
-
- <!-- Horizontal padding for the widget pager -->
- <dimen name="kg_widget_pager_horizontal_padding">32dp</dimen>
-
- <dimen name="widget_big_font_size">150dp</dimen>
-</resources>
diff --git a/packages/Keyguard/res/values-sw720dp-port/integers.xml b/packages/Keyguard/res/values-sw720dp-port/integers.xml
deleted file mode 100644
index 5f85f71..0000000
--- a/packages/Keyguard/res/values-sw720dp-port/integers.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<resources>
- <integer name="kg_widget_region_weight">48</integer>
- <integer name="kg_security_flipper_weight">52</integer>
-</resources>
\ No newline at end of file
diff --git a/packages/Keyguard/res/values-sw720dp/dimens.xml b/packages/Keyguard/res/values-sw720dp/dimens.xml
index 86d155e..428c18e 100644
--- a/packages/Keyguard/res/values-sw720dp/dimens.xml
+++ b/packages/Keyguard/res/values-sw720dp/dimens.xml
@@ -17,40 +17,6 @@
*/
-->
<resources>
- <!-- Keyguard dimensions -->
- <!-- Size of the clock font in keyguard's status view -->
- <dimen name="kg_status_clock_font_size">140dp</dimen>
-
- <!-- Top margin for the clock view -->
- <dimen name="kg_clock_top_margin">0dp</dimen>
-
- <!-- Size of margin on the right of keyguard's status view -->
- <dimen name="kg_status_line_font_right_margin">32dp</dimen>
-
- <!-- Horizontal padding for the widget pager -->
- <dimen name="kg_widget_pager_horizontal_padding">80dp</dimen>
-
- <!-- Top padding for the widget pager -->
- <dimen name="kg_widget_pager_top_padding">0dp</dimen>
-
- <!-- Bottom padding for the widget pager -->
- <dimen name="kg_widget_pager_bottom_padding">0dp</dimen>
-
- <!-- Top margin for the runway lights. We add a negative margin in large
- devices to account for the widget pager padding -->
- <dimen name="kg_runway_lights_top_margin">-30dp</dimen>
-
- <!-- Margin around the various security views -->
- <dimen name="keyguard_muliuser_selector_margin">24dp</dimen>
-
- <!-- Stroke width of the frame for the circular avatars. -->
- <dimen name="keyguard_avatar_frame_stroke_width">3dp</dimen>
-
- <!-- Size of the avator on the multiuser lockscreen. -->
- <dimen name="keyguard_avatar_size">88dp</dimen>
-
- <!-- Size of the text under the avator on the multiuser lockscreen. -->
- <dimen name="keyguard_avatar_name_size">12sp</dimen>
<!-- Width of the sliding KeyguardSecurityContainer (includes 2x keyguard_security_view_margin) -->
<dimen name="keyguard_security_width">420dp</dimen>
diff --git a/packages/Keyguard/res/values/alias.xml b/packages/Keyguard/res/values/alias.xml
index 09e9591..f06b450 100644
--- a/packages/Keyguard/res/values/alias.xml
+++ b/packages/Keyguard/res/values/alias.xml
@@ -22,18 +22,6 @@
<!-- Alias used to reference framework color for transparency. -->
<item type="color" name="transparent">@android:color/transparent</item>
- <!-- Alias used to reference framework drawable in keyguard. -->
- <item type="drawable" name="stat_sys_warning">@android:drawable/stat_sys_warning</item>
-
- <!-- Alias used to reference framework drawable in keyguard. -->
- <item type="drawable" name="ic_media_pause">@android:drawable/ic_media_pause</item>
-
- <!-- Alias used to reference framework drawable in keyguard. -->
- <item type="drawable" name="ic_media_stop">@*android:drawable/ic_media_stop</item>
-
- <!-- Alias used to reference framework drawable in keyguard. -->
- <item type="drawable" name="ic_contact_picture">@*android:drawable/ic_contact_picture</item>
-
<!-- Alias used to reference framework "OK" string in keyguard. -->
<item type="string" name="ok">@*android:string/ok</item>
diff --git a/packages/Keyguard/res/values/attrs.xml b/packages/Keyguard/res/values/attrs.xml
index 9100140..96a5bcc 100644
--- a/packages/Keyguard/res/values/attrs.xml
+++ b/packages/Keyguard/res/values/attrs.xml
@@ -20,113 +20,9 @@
-->
<resources>
- <!-- Standard gravity constant that a child supplies to its parent.
- Defines how the child view should be positioned, on both the X and Y axes, within its enclosing layout. -->
- <attr name="layout_gravity">
- <!-- Push object to the top of its container, not changing its size. -->
- <flag name="top" value="0x30" />
- <!-- Push object to the bottom of its container, not changing its size. -->
- <flag name="bottom" value="0x50" />
- <!-- Push object to the left of its container, not changing its size. -->
- <flag name="left" value="0x03" />
- <!-- Push object to the right of its container, not changing its size. -->
- <flag name="right" value="0x05" />
- <!-- Place object in the vertical center of its container, not changing its size. -->
- <flag name="center_vertical" value="0x10" />
- <!-- Grow the vertical size of the object if needed so it completely fills its container. -->
- <flag name="fill_vertical" value="0x70" />
- <!-- Place object in the horizontal center of its container, not changing its size. -->
- <flag name="center_horizontal" value="0x01" />
- <!-- Grow the horizontal size of the object if needed so it completely fills its container. -->
- <flag name="fill_horizontal" value="0x07" />
- <!-- Place the object in the center of its container in both the vertical and horizontal axis, not changing its size. -->
- <flag name="center" value="0x11" />
- <!-- Grow the horizontal and vertical size of the object if needed so it completely fills its container. -->
- <flag name="fill" value="0x77" />
- <!-- Additional option that can be set to have the top and/or bottom edges of
- the child clipped to its container's bounds.
- The clip will be based on the vertical gravity: a top gravity will clip the bottom
- edge, a bottom gravity will clip the top edge, and neither will clip both edges. -->
- <flag name="clip_vertical" value="0x80" />
- <!-- Additional option that can be set to have the left and/or right edges of
- the child clipped to its container's bounds.
- The clip will be based on the horizontal gravity: a left gravity will clip the right
- edge, a right gravity will clip the left edge, and neither will clip both edges. -->
- <flag name="clip_horizontal" value="0x08" />
- <!-- Push object to the beginning of its container, not changing its size. -->
- <flag name="start" value="0x00800003" />
- <!-- Push object to the end of its container, not changing its size. -->
- <flag name="end" value="0x00800005" />
- </attr>
-
-
- <!-- PagedView specific attributes. These attributes are used to customize
- a PagedView view in XML files. -->
- <declare-styleable name="PagedView">
- <!-- The space between adjacent pages of the PagedView. -->
- <attr name="pageSpacing" format="dimension" />
- <!-- The padding for the scroll indicator area -->
- <attr name="scrollIndicatorPaddingLeft" format="dimension" />
- <attr name="scrollIndicatorPaddingRight" format="dimension" />
- </declare-styleable>
-
- <declare-styleable name="KeyguardGlowStripView">
- <attr name="dotSize" format="dimension" />
- <attr name="numDots" format="integer" />
- <attr name="glowDot" format="reference" />
- <attr name="leftToRight" format="boolean" />
- </declare-styleable>
-
- <!-- Some child types have special behavior. -->
- <attr name="layout_childType">
- <!-- No special behavior. Layout will proceed as normal. -->
- <enum name="none" value="0" />
- <!-- Widget container.
- This will be resized in response to certain events. -->
- <enum name="widget" value="1" />
- <!-- Security challenge container.
- This will be dismissed/shown in response to certain events,
- possibly obscuring widget elements. -->
- <enum name="challenge" value="2" />
- <!-- User switcher.
- This will consume space from the total layout area. -->
- <enum name="userSwitcher" value="3" />
- <!-- Scrim. This will block access to child views that
- come before it in the child list in bouncer mode. -->
- <enum name="scrim" value="4" />
- <!-- The home for widgets. All widgets will be descendents of this. -->
- <enum name="widgets" value="5" />
- <!-- This is a handle that is used for expanding the
- security challenge container when it is collapsed. -->
- <enum name="expandChallengeHandle" value="6" />
- <!-- Delete drop target. This will be the drop target to delete pages. -->
- <enum name="pageDeleteDropTarget" value="7" />
- </attr>
-
- <declare-styleable name="SlidingChallengeLayout_Layout">
- <attr name="layout_childType" />
- <attr name="layout_maxHeight" format="dimension" />
- </declare-styleable>
-
- <declare-styleable name="MultiPaneChallengeLayout">
- <!-- Influences how layout_centerWithinArea behaves -->
- <attr name="android:orientation" />
- </declare-styleable>
-
- <declare-styleable name="MultiPaneChallengeLayout_Layout">
- <!-- Percentage of the screen this child should consume or center within.
- If 0/default, the view will be measured by standard rules
- as if this were a FrameLayout. -->
- <attr name="layout_centerWithinArea" format="float" />
- <attr name="layout_childType" />
- <attr name="layout_gravity" />
- <attr name="layout_maxWidth" format="dimension" />
- <attr name="layout_maxHeight" />
- </declare-styleable>
-
<declare-styleable name="KeyguardSecurityViewFlipper_Layout">
- <attr name="layout_maxWidth" />
- <attr name="layout_maxHeight" />
+ <attr name="layout_maxWidth" format="dimension"/>
+ <attr name="layout_maxHeight" format="dimension" />
</declare-styleable>
<declare-styleable name="NumPadKey">
diff --git a/packages/Keyguard/res/values/bools.xml b/packages/Keyguard/res/values/bools.xml
index 5e842d7..2b83787 100644
--- a/packages/Keyguard/res/values/bools.xml
+++ b/packages/Keyguard/res/values/bools.xml
@@ -15,9 +15,6 @@
-->
<resources>
- <bool name="kg_enable_camera_default_widget">true</bool>
- <bool name="kg_center_small_widgets_vertically">false</bool>
- <bool name="kg_top_align_page_shrink_on_bouncer_visible">true</bool>
<bool name="kg_show_ime_at_screen_on">true</bool>
<bool name="kg_use_all_caps">true</bool>
</resources>
diff --git a/packages/Keyguard/res/values/colors.xml b/packages/Keyguard/res/values/colors.xml
index 4e28eff..3b741ea 100644
--- a/packages/Keyguard/res/values/colors.xml
+++ b/packages/Keyguard/res/values/colors.xml
@@ -14,15 +14,6 @@
limitations under the License.
-->
<resources>
- <!-- Keyguard colors -->
- <color name="keyguard_avatar_frame_color">#ffffffff</color>
- <color name="keyguard_avatar_frame_shadow_color">#80000000</color>
- <color name="keyguard_avatar_nick_color">#ffffffff</color>
- <color name="keyguard_avatar_frame_pressed_color">#ff35b5e5</color>
- <color name="kg_widget_pager_gradient">#ffffffff</color>
-
- <!-- FaceLock -->
- <color name="facelock_spotlight_mask">#CC000000</color>
<!-- Clock -->
<color name="clock_white">#ffffffff</color>
diff --git a/packages/Keyguard/res/values/config.xml b/packages/Keyguard/res/values/config.xml
index de17c4b..8d9d6ee 100644
--- a/packages/Keyguard/res/values/config.xml
+++ b/packages/Keyguard/res/values/config.xml
@@ -20,13 +20,6 @@
<!-- These resources are around just to allow their values to be customized -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- Package name for default keyguard appwidget [DO NOT TRANSLATE] -->
- <string name="widget_default_package_name"></string>
-
- <!-- Class name for default keyguard appwidget [DO NOT TRANSLATE] -->
- <string name="widget_default_class_name"></string>
-
<!-- Allow the menu hard key to be disabled in LockScreen on some devices [DO NOT TRANSLATE] -->
<bool name="config_disableMenuKeyInLockScreen">false</bool>
-
</resources>
diff --git a/packages/Keyguard/res/values/dimens.xml b/packages/Keyguard/res/values/dimens.xml
index 8326d75..9290236 100644
--- a/packages/Keyguard/res/values/dimens.xml
+++ b/packages/Keyguard/res/values/dimens.xml
@@ -18,101 +18,10 @@
*/
-->
<resources>
- <!-- Size of lockscreen outerring on unsecure unlock LockScreen -->
- <dimen name="keyguard_lockscreen_outerring_diameter">270dp</dimen>
-
- <!-- The bottom margin for the GlowPadView container -->
- <dimen name="glowpadcontainer_bottom_margin">-80dp</dimen>
-
- <!-- Default target placement radius for GlowPadView. Should be 1/2 of outerring diameter. -->
- <dimen name="glowpadview_target_placement_radius">135dip</dimen>
-
- <!-- Default glow radius for GlowPadView -->
- <dimen name="glowpadview_glow_radius">75dip</dimen>
-
- <!-- Default distance beyond which GlowPadView snaps to the matching target -->
- <dimen name="glowpadview_snap_margin">40dip</dimen>
-
- <!-- Default distance from each snap target that GlowPadView considers a "hit" -->
- <dimen name="glowpadview_inner_radius">15dip</dimen>
-
- <!-- Size of status line font on Unsecure unlock LockScreen. -->
- <dimen name="keyguard_lockscreen_status_line_font_size">14dip</dimen>
-
- <!-- Size of right margin on Unsecure unlock LockScreen -->
- <dimen name="keyguard_lockscreen_status_line_font_right_margin">42dip</dimen>
-
- <!-- Size of top margin on Clock font to edge on unlock LockScreen -->
- <dimen name="keyguard_lockscreen_status_line_clockfont_top_margin">22dip</dimen>
-
- <!-- Size of top margin on Clock font to edge on unlock LockScreen -->
- <dimen name="keyguard_lockscreen_status_line_clockfont_bottom_margin">12dip</dimen>
-
- <!-- Padding on left margin of PIN text entry field to center it when del button is showing -->
- <dimen name="keyguard_lockscreen_pin_margin_left">40dip</dimen>
-
- <!-- Height of FaceUnlock view in keyguard -->
- <dimen name="face_unlock_height">330dip</dimen>
-
- <!-- Keyguard dimensions -->
- <!-- TEMP -->
- <dimen name="kg_security_panel_height">600dp</dimen>
-
- <!-- Height of security view in keyguard. -->
- <dimen name="kg_security_view_height">480dp</dimen>
-
- <!-- Width of widget view in keyguard. -->
- <dimen name="kg_widget_view_width">0dp</dimen>
-
- <!-- Height of widget view in keyguard. -->
- <dimen name="kg_widget_view_height">0dp</dimen>
-
- <!-- Size of the clock font in keyguard's status view -->
- <dimen name="kg_status_clock_font_size">75dp</dimen>
<!-- Size of the generic status lines keyguard's status view -->
<dimen name="kg_status_line_font_size">14sp</dimen>
- <!-- Size of margin on the right of keyguard's status view -->
- <dimen name="kg_status_line_font_right_margin">16dp</dimen>
-
- <!-- Top margin for the clock view -->
- <dimen name="kg_clock_top_margin">-16dp</dimen>
-
- <!-- Horizontal gap between keys in PIN and SIM PIN numeric keyboards in keyguard -->
- <dimen name="kg_key_horizontal_gap">0dp</dimen>
-
- <!-- Horizontal gap between keys in PIN and SIM PIN numeric keyboards in keyguard -->
- <dimen name="kg_key_vertical_gap">0dp</dimen>
-
- <!-- Horizontal gap between keys in PIN and SIM PIN numeric keyboards in keyguard -->
- <dimen name="kg_pin_key_height">60dp</dimen>
-
- <!-- Space reserved at the bottom of secure views (pin/pattern/password/SIM pin/SIM puk) -->
- <dimen name="kg_secure_padding_height">46dp</dimen>
-
- <!-- The height of the runway lights strip -->
- <dimen name="kg_runway_lights_height">7dp</dimen>
-
- <!-- The height of the runway lights strip -->
- <dimen name="kg_runway_lights_vertical_padding">2dp</dimen>
-
- <!-- Horizontal padding for the widget pager -->
- <dimen name="kg_widget_pager_horizontal_padding">16dp</dimen>
-
- <!-- Top padding for the widget pager -->
- <dimen name="kg_widget_pager_top_padding">0dp</dimen>
-
- <!-- Bottom padding for the widget pager -->
- <dimen name="kg_widget_pager_bottom_padding">64dp</dimen>
-
- <!-- Top margin for the runway lights. We add a negative margin in large
- devices to account for the widget pager padding -->
- <dimen name="kg_runway_lights_top_margin">0dp</dimen>
-
- <!-- Touch slop for the global toggle accessibility gesture -->
- <dimen name="accessibility_touch_slop">80dip</dimen>
-
<!-- Width of the sliding KeyguardSecurityContainer (includes 2x keyguard_security_view_margin) -->
<dimen name="keyguard_security_width">320dp</dimen>
@@ -125,44 +34,14 @@
<!-- Margin around the various security views -->
<dimen name="keyguard_security_view_margin">8dp</dimen>
- <!-- Margin around the various security views -->
- <dimen name="keyguard_muliuser_selector_margin">8dp</dimen>
-
- <!-- Stroke width of the frame for the circular avatars. -->
- <dimen name="keyguard_avatar_frame_stroke_width">2dp</dimen>
-
- <!-- Shadow radius under the frame for the circular avatars. -->
- <dimen name="keyguard_avatar_frame_shadow_radius">1dp</dimen>
-
- <!-- Size of the avator on hte multiuser lockscreen. -->
- <dimen name="keyguard_avatar_size">66dp</dimen>
-
- <!-- Size of the text under the avator on the multiuser lockscreen. -->
- <dimen name="keyguard_avatar_name_size">10sp</dimen>
-
- <!-- Size of the region along the edge of the screen that will accept
- swipes to scroll the widget area. -->
- <dimen name="kg_edge_swipe_region_size">24dp</dimen>
-
- <!-- If the height if keyguard drops below this threshold (most likely
- due to the appearance of the IME), then drop the multiuser selector. -->
- <dimen name="kg_squashed_layout_threshold">600dp</dimen>
-
- <!-- The height of widgets which do not support vertical resizing. This is only
- used on tablets; on phones, this size is determined by the space left by the
- security mode. -->
- <dimen name="kg_small_widget_height">160dp</dimen>
-
<!-- EmergencyCarrierArea overlap - amount to overlap the emergency button and carrier text.
Should be 0 on devices with plenty of room (e.g. tablets) -->
<dimen name="eca_overlap">-10dip</dimen>
<!-- Default clock parameters -->
<dimen name="bottom_text_spacing_digital">-10dp</dimen>
- <dimen name="label_font_size">14dp</dimen>
<dimen name="widget_label_font_size">16sp</dimen>
<dimen name="widget_big_font_size">88dp</dimen>
- <dimen name="big_font_size">120dp</dimen>
<!-- The y translation to apply at the start in appear animations. -->
<dimen name="appear_y_translation_start">32dp</dimen>
diff --git a/packages/Keyguard/res/values/integers.xml b/packages/Keyguard/res/values/integers.xml
deleted file mode 100644
index dc90bbf..0000000
--- a/packages/Keyguard/res/values/integers.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<resources>
- <integer name="kg_carousel_angle">75</integer>
- <integer name="kg_glowpad_rotation_offset">0</integer>
-</resources>
diff --git a/packages/Keyguard/res/values/strings.xml b/packages/Keyguard/res/values/strings.xml
index feab127..8b18b2ed 100644
--- a/packages/Keyguard/res/values/strings.xml
+++ b/packages/Keyguard/res/values/strings.xml
@@ -48,12 +48,6 @@
to unlock the keyguard. Displayed in one line in a large font. -->
<string name="keyguard_password_wrong_pin_code">Incorrect PIN code.</string>
- <!-- Instructions telling the user how to unlock the phone. -->
- <string name="keyguard_label_text">To unlock, press Menu then 0.</string>
-
- <!-- Shown when face unlock failed multiple times so we're just using the backup -->
- <string name="faceunlock_multiple_failures">Maximum Face Unlock attempts exceeded</string>
-
<!-- When the lock screen is showing, the phone is plugged in and the battery is fully
charged, say that it is charged. -->
<string name="keyguard_charged">Charged</string>
@@ -101,35 +95,6 @@
<!-- Time format strings for fall-back clock widget -->
<string name="keyguard_widget_24_hours_format" translatable="false">kk\uee01mm</string>
- <!-- Accessibility description sent when user changes the current lock screen widget. [CHAR_LIMIT=none] -->
- <string name="keyguard_accessibility_widget_changed">%1$s. Widget %2$d of %3$d.</string>
- <!-- Accessibility description of the add widget button. [CHAR_LIMIT=none] -->
- <string name="keyguard_accessibility_add_widget">Add widget.</string>
- <!-- Accessibility description of the empty sidget slot (place holder for a new widget). [CHAR_LIMIT=none] -->
- <string name="keyguard_accessibility_widget_empty_slot">Empty</string>
- <!-- Accessibility description of the event of expanding an unlock area. [CHAR_LIMIT=none] -->
- <string name="keyguard_accessibility_unlock_area_expanded">Unlock area expanded.</string>
- <!-- Accessibility description of the event of collapsing an unlock area. [CHAR_LIMIT=none] -->
- <string name="keyguard_accessibility_unlock_area_collapsed">Unlock area collapsed.</string>
- <!-- Accessibility description of a lock screen widget. [CHAR_LIMIT=none] -->
- <string name="keyguard_accessibility_widget"><xliff:g id="widget_index">%1$s</xliff:g> widget.</string>
- <!-- Accessibility description of the lock screen user selector widget. [CHAR_LIMIT=none] -->
- <string name="keyguard_accessibility_user_selector">User selector</string>
- <!-- Accessibility description of the camera widget. [CHAR_LIMIT=none] -->
- <string name="keyguard_accessibility_camera">Camera</string>
- <!-- Accessibility description of the lock media control widget. [CHAR_LIMIT=none] -->
- <string name="keygaurd_accessibility_media_controls">Media controls</string>
- <!-- Accessibility description of widget reordering start. [CHAR_LIMIT=none] -->
- <string name="keyguard_accessibility_widget_reorder_start">Widget reordering started.</string>
- <!-- Accessibility description of widget reordering end. [CHAR_LIMIT=none] -->
- <string name="keyguard_accessibility_widget_reorder_end">Widget reordering ended.</string>
- <!-- Accessibility description of the a widget deletion event. [CHAR_LIMIT=none] -->
- <string name="keyguard_accessibility_widget_deleted">Widget <xliff:g id="widget_index">%1$s</xliff:g> deleted.</string>
- <!-- Accessibility description of the button to expand the lock area. [CHAR_LIMIT=none] -->
- <string name="keyguard_accessibility_expand_lock_area">Expand unlock area.</string>
- <!-- Accessibility description of the slide unlock. [CHAR_LIMIT=none] -->
- <string name="keyguard_accessibility_slide_unlock">Slide unlock.</string>
- <!-- Accessibility description of the pattern unlock. [CHAR_LIMIT=none] -->
<string name="keyguard_accessibility_pattern_unlock">Pattern unlock.</string>
<!-- Accessibility description of the face unlock. [CHAR_LIMIT=none] -->
<string name="keyguard_accessibility_face_unlock">Face unlock.</string>
@@ -148,88 +113,15 @@
<!-- Accessibility description of the SIM PUK password view. [CHAR_LIMIT=none] -->
<string name="keyguard_accessibility_sim_puk_area">SIM PUK area</string>
- <!-- Shown on transport control of lockscreen. Pressing button goes to previous track. -->
- <string name="keyguard_accessibility_transport_prev_description">Previous track button</string>
- <!-- Shown on transport control of lockscreen. Pressing button goes to next track. -->
- <string name="keyguard_accessibility_transport_next_description">Next track button</string>
- <!-- Shown on transport control of lockscreen. Pressing button pauses playback -->
- <string name="keyguard_accessibility_transport_pause_description">Pause button</string>
- <!-- Shown on transport control of lockscreen. Pressing button pauses playback -->
- <string name="keyguard_accessibility_transport_play_description">Play button</string>
- <!-- Shown on transport control of lockscreen. Pressing button pauses playback -->
- <string name="keyguard_accessibility_transport_stop_description">Stop button</string>
- <!-- Shown on transport control of lockscreen. Pressing button rates the track as "thumbs up." -->
- <string name="keyguard_accessibility_transport_thumbs_up_description">Thumbs up</string>
- <!-- Shown on transport control of lockscreen. Pressing button rates the track as "thumbs down." -->
- <string name="keyguard_accessibility_transport_thumbs_down_description">Thumbs down</string>
- <!-- Shown on transport control of lockscreen. Pressing button toggles the "heart" rating. -->
- <string name="keyguard_accessibility_transport_heart_description">Heart</string>
-
-
- <!-- Accessibility description for when the device prompts the user to dismiss keyguard
- in order to complete an action. This will be followed by a message about the current
- security option (e.g. "Pattern unlock."). [CHAR LIMIT=NONE] -->
- <string name="keyguard_accessibility_show_bouncer">Unlock to continue</string>
-
- <!-- Accessibility description for when the bouncer prompt is dismissed. [CHAR LIMIT=NONE] -->
- <string name="keyguard_accessibility_hide_bouncer">Launch canceled</string>
-
- <!-- Accessibility description announced when user drags widget over the delete drop target [CHAR LIMIT=NONE] -->
- <string name="keyguard_accessibility_delete_widget_start">Drop <xliff:g id="widget_index">%1$s</xliff:g> to delete.</string>
-
- <!-- Accessibility description announced when user drags widget away from delete drop target [CHAR LIMIT=NONE] -->
- <string name="keyguard_accessibility_delete_widget_end"><xliff:g id="widget_index">%1$s</xliff:g> will not be deleted.</string>
-
<!-- Accessibility description for the text view that indicates when the next alarm is set (not shown on screen). [CHAR_LIMIT=none] -->
<string name="keyguard_accessibility_next_alarm">Next alarm set for <xliff:g id="alarm" example="Fri 8:30 AM">%1$s</xliff:g></string>
- <!-- Password keyboard strings. Used by LockScreen and Settings --><skip />
- <!-- Label for "switch to symbols" key. Must be short to fit on key! -->
- <string name="password_keyboard_label_symbol_key">\?123</string>
- <!-- Label for "switch to alphabetic" key. Must be short to fit on key! -->
- <string name="password_keyboard_label_alpha_key">ABC</string>
- <!-- Label for ALT modifier key. Must be short to fit on key! -->
- <string name="password_keyboard_label_alt_key">ALT</string>
-
- <!-- KeyboardView - accessibility support --><skip />
- <!-- Description of the Alt button in a KeyboardView. [CHAR LIMIT=NONE] -->
- <string name="keyboardview_keycode_alt">Alt</string>
- <!-- Description of the Cancel button in a KeyboardView. [CHAR LIMIT=NONE] -->
- <string name="keyboardview_keycode_cancel">Cancel</string>
+ <!-- KeyguardPinView - accessibility support --><skip />
<!-- Description of the Delete button in a KeyboardView. [CHAR LIMIT=NONE] -->
<string name="keyboardview_keycode_delete">Delete</string>
- <!-- Description of the Done button in a KeyboardView. [CHAR LIMIT=NONE] -->
- <string name="keyboardview_keycode_done">Done</string>
- <!-- Description of the Mode change button in a KeyboardView. [CHAR LIMIT=NONE] -->
- <string name="keyboardview_keycode_mode_change">Mode change</string>
- <!-- Description of the Shift button in a KeyboardView. [CHAR LIMIT=NONE] -->
- <string name="keyboardview_keycode_shift">Shift</string>
<!-- Description of the Enter button in a KeyboardView. [CHAR LIMIT=NONE] -->
<string name="keyboardview_keycode_enter">Enter</string>
- <!-- Description of the unlock target in the Slide unlock screen. [CHAR LIMIT=NONE] -->
- <string name="description_target_unlock">Unlock</string>
- <!-- Description of the camera target in the Slide unlock screen. [CHAR LIMIT=NONE] -->
- <string name="description_target_camera">Camera</string>
- <!-- Description of the silent target in the Slide unlock screen. [CHAR LIMIT=NONE] -->
- <string name="description_target_silent">Silent</string>
- <!-- Description of the sound on target in the Slide unlock screen. [CHAR LIMIT=NONE] -->
- <string name="description_target_soundon">Sound on</string>
- <!-- Description of the unlock target in the Slide unlock screen. [CHAR LIMIT=NONE] -->
- <string name="description_target_search">Search</string>
-
- <!-- Description of the up direction in which one can to slide the handle in the Slide unlock screen. [CHAR LIMIT=NONE] -->
- <string name="description_direction_up">Slide up for <xliff:g id="target_description" example="Unlock">%s</xliff:g>.</string>
- <!-- Description of the down direction in which one can to slide the handle in the Slide unlock screen. [CHAR LIMIT=NONE] -->
- <string name="description_direction_down">Slide down for <xliff:g id="target_description" example="Unlock">%s</xliff:g>.</string>
- <!-- Description of the left direction in which one can to slide the handle in the Slide unlock screen. [CHAR LIMIT=NONE] -->
- <string name="description_direction_left">"Slide left for <xliff:g id="target_description" example="Unlock">%s</xliff:g>.</string>
- <!-- Description of the right direction in which one can to slide the handle in the Slide unlock screen. [CHAR LIMIT=NONE] -->
- <string name="description_direction_right">Slide right for <xliff:g id="target_description" example="Unlock">%s</xliff:g>.</string>
-
- <!-- Text spoken when the current user is switched if accessibility is enabled. [CHAR LIMIT=none] -->
- <string name="user_switched">Current user <xliff:g id="name" example="Bob">%1$s</xliff:g>.</string>
-
<!-- Label shown on emergency call button in keyguard -->
<string name="kg_emergency_call_label">Emergency call</string>
<!-- Message shown in pattern unlock after some number of unsuccessful attempts -->
@@ -272,20 +164,6 @@
<string name="kg_invalid_confirm_pin_hint" product="default">PIN codes does not match</string>
<!-- Message shown when the user exceeds the maximum number of pattern attempts -->
<string name="kg_login_too_many_attempts">Too many pattern attempts</string>
- <!-- Instructions show in account unlock screen allowing user to enter their email password -->
- <string name="kg_login_instructions">To unlock, sign in with your Google account.</string>
- <!-- Hint shown in TextView in account unlock screen of keyguard -->
- <string name="kg_login_username_hint">Username (email)</string>
- <!-- Hint shown in TextView in account unlock screen of keyguard -->
- <string name="kg_login_password_hint">Password</string>
- <!-- Label shown on sign in button on account unlock screen of keyguard -->
- <string name="kg_login_submit_button">Sign in</string>
- <!-- Message shown when the user enters an invalid username/password combination in account unlock screen of keyguard -->
- <string name="kg_login_invalid_input">Invalid username or password.</string>
- <!-- Hint text shown when user has too many failed password attempts in account unlock screen of keyguard -->
- <string name="kg_login_account_recovery_hint">Forgot your username or password\?\nVisit <b>google.com/accounts/recovery</b>.</string>
- <!-- Message shown while device checks username/password in account unlock screen of keyguard -->
- <string name="kg_login_checking_password">Checking account\u2026</string>
<!-- Message shown in dialog when max number of attempts are reached for PIN screen of keyguard -->
<string name="kg_too_many_failed_pin_attempts_dialog_message">
You have incorrectly typed your PIN <xliff:g id="number">%d</xliff:g> times.
@@ -386,8 +264,6 @@
you will be asked to unlock your phone using an email account.\n\n
Try again in <xliff:g id="number">%d</xliff:g> seconds.
</string>
- <!-- The delete-widget drop target button text -->
- <string name="kg_reordering_delete_drop_target_text">Remove</string>
<!-- Instructions telling the user that they entered the wrong SIM PIN for the last time.
Displayed in a dialog box. -->
@@ -417,18 +293,6 @@
<!-- Notification telling the user that the PIN1 they entered is valid -->
<string name="kg_pin_accepted">Code Accepted!</string>
- <!-- Transport control strings -->
- <!-- Shown on transport control of lockscreen. Pressing button goes to previous track. -->
- <string name="keyguard_transport_prev_description">Previous track button</string>
- <!-- Shown on transport control of lockscreen. Pressing button goes to next track. -->
- <string name="keyguard_transport_next_description">Next track button</string>
- <!-- Shown on transport control of lockscreen. Pressing button pauses playback -->
- <string name="keyguard_transport_pause_description">Pause button</string>
- <!-- Shown on transport control of lockscreen. Pressing button pauses playback -->
- <string name="keyguard_transport_play_description">Play button</string>
- <!-- Shown on transport control of lockscreen. Pressing button pauses playback -->
- <string name="keyguard_transport_stop_description">Stop button</string>
-
<!-- On the keyguard screen, it shows the carrier the phone is connected to.
This is displayed if the phone is not connected to a carrier.-->
<string name="keyguard_carrier_default">No service.</string>
diff --git a/packages/Keyguard/res/values/styles.xml b/packages/Keyguard/res/values/styles.xml
index 7d161af..404a17e 100644
--- a/packages/Keyguard/res/values/styles.xml
+++ b/packages/Keyguard/res/values/styles.xml
@@ -35,36 +35,13 @@
<item name="android:paddingBottom">0dp</item>
</style>
- <!-- Standard animations for a non-full-screen window or activity. -->
- <style name="Animation.LockScreen" parent="@android:style/Animation">
- <item name="android:windowEnterAnimation">@anim/lock_screen_enter</item>
- <item name="android:windowExitAnimation">@anim/lock_screen_exit</item>
- </style>
-
<!-- Built-in clock widget stuff -->
<style name="widget_label">
<item name="android:textSize">@dimen/widget_label_font_size</item>
</style>
- <style name="big_thin">
- <item name="android:textSize">@dimen/big_font_size</item>
- <item name="android:fontFamily">sans-serif-thin</item>
- </style>
- <style name="widget_big_thin" parent="big_thin">
+ <style name="widget_big_thin">
<item name="android:textSize">@dimen/widget_big_font_size</item>
- </style>
-
- <style name="Widget.TransportControl.SeekBar" parent="@android:style/Widget.DeviceDefault.Light.SeekBar">
- <item name="android:indeterminateOnly">false</item>
- <item name="android:progressDrawable">@drawable/scrubber_progress_horizontal_holo_light</item>
- <item name="android:indeterminateDrawable">@drawable/scrubber_progress_horizontal_holo_light</item>
- <item name="android:minHeight">13dip</item>
- <item name="android:maxHeight">13dip</item>
- <item name="android:thumb">@drawable/scrubber_control_selector_holo</item>
- <item name="android:thumbOffset">16dip</item>
- <item name="android:focusable">true</item>
- <item name="android:paddingStart">16dip</item>
- <item name="android:paddingEnd">16dip</item>
- <item name="android:mirrorForRtl">true</item>
+ <item name="android:fontFamily">sans-serif-thin</item>
</style>
<style name="BouncerSecurityContainer">
diff --git a/packages/Keyguard/src/com/android/keyguard/BiometricSensorUnlock.java b/packages/Keyguard/src/com/android/keyguard/BiometricSensorUnlock.java
deleted file mode 100644
index 230ef81..0000000
--- a/packages/Keyguard/src/com/android/keyguard/BiometricSensorUnlock.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import android.view.View;
-
-interface BiometricSensorUnlock {
- /**
- * Initializes the view provided for the biometric unlock UI to work within. The provided area
- * completely covers the backup unlock mechanism.
- * @param biometricUnlockView View provided for the biometric unlock UI.
- */
- public void initializeView(View biometricUnlockView);
-
- /**
- * Indicates whether the biometric unlock is running. Before
- * {@link BiometricSensorUnlock#start} is called, isRunning() returns false. After a successful
- * call to {@link BiometricSensorUnlock#start}, isRunning() returns true until the biometric
- * unlock completes, {@link BiometricSensorUnlock#stop} has been called, or an error has
- * forced the biometric unlock to stop.
- * @return whether the biometric unlock is currently running.
- */
- public boolean isRunning();
-
- /**
- * Stops and removes the biometric unlock and shows the backup unlock
- */
- public void stopAndShowBackup();
-
- /**
- * Binds to the biometric unlock service and starts the unlock procedure. Called on the UI
- * thread.
- * @return false if it can't be started or the backup should be used.
- */
- public boolean start();
-
- /**
- * Stops the biometric unlock procedure and unbinds from the service. Called on the UI thread.
- * @return whether the biometric unlock was running when called.
- */
- public boolean stop();
-
- /**
- * Cleans up any resources used by the biometric unlock.
- */
- public void cleanUp();
-
- /**
- * Gets the Device Policy Manager quality of the biometric unlock sensor
- * (e.g., PASSWORD_QUALITY_BIOMETRIC_WEAK).
- * @return biometric unlock sensor quality, as defined by Device Policy Manager.
- */
- public int getQuality();
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/CameraWidgetFrame.java b/packages/Keyguard/src/com/android/keyguard/CameraWidgetFrame.java
deleted file mode 100644
index 2bf74ea..0000000
--- a/packages/Keyguard/src/com/android/keyguard/CameraWidgetFrame.java
+++ /dev/null
@@ -1,523 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import android.content.Context;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.graphics.Color;
-import android.graphics.Point;
-import android.graphics.Rect;
-import android.os.Handler;
-import android.os.SystemClock;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.WindowManager;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.ImageView.ScaleType;
-
-import com.android.keyguard.KeyguardActivityLauncher.CameraWidgetInfo;
-
-public class CameraWidgetFrame extends KeyguardWidgetFrame implements View.OnClickListener {
- private static final String TAG = CameraWidgetFrame.class.getSimpleName();
- private static final boolean DEBUG = KeyguardConstants.DEBUG;
- private static final int WIDGET_ANIMATION_DURATION = 250; // ms
- private static final int WIDGET_WAIT_DURATION = 400; // ms
- private static final int RECOVERY_DELAY = 1000; // ms
-
- interface Callbacks {
- void onLaunchingCamera();
- void onCameraLaunchedSuccessfully();
- void onCameraLaunchedUnsuccessfully();
- }
-
- private final Handler mHandler = new Handler();
- private final KeyguardActivityLauncher mActivityLauncher;
- private final Callbacks mCallbacks;
- private final CameraWidgetInfo mWidgetInfo;
- private final WindowManager mWindowManager;
- private final Point mRenderedSize = new Point();
- private final int[] mTmpLoc = new int[2];
-
- private long mLaunchCameraStart;
- private boolean mActive;
- private boolean mTransitioning;
- private boolean mDown;
-
- private final Rect mInsets = new Rect();
-
- private FixedSizeFrameLayout mPreview;
- private View mFullscreenPreview;
- private View mFakeNavBar;
- private boolean mUseFastTransition;
-
- private final Runnable mTransitionToCameraRunnable = new Runnable() {
- @Override
- public void run() {
- transitionToCamera();
- }};
-
- private final Runnable mTransitionToCameraEndAction = new Runnable() {
- @Override
- public void run() {
- if (!mTransitioning)
- return;
- Handler worker = getWorkerHandler() != null ? getWorkerHandler() : mHandler;
- mLaunchCameraStart = SystemClock.uptimeMillis();
- if (DEBUG) Log.d(TAG, "Launching camera at " + mLaunchCameraStart);
- mActivityLauncher.launchCamera(worker, mSecureCameraActivityStartedRunnable);
- }};
-
- private final Runnable mPostTransitionToCameraEndAction = new Runnable() {
- @Override
- public void run() {
- mHandler.post(mTransitionToCameraEndAction);
- }};
-
- private final Runnable mRecoverRunnable = new Runnable() {
- @Override
- public void run() {
- recover();
- }};
-
- private final Runnable mRenderRunnable = new Runnable() {
- @Override
- public void run() {
- render();
- }};
-
- private final Runnable mSecureCameraActivityStartedRunnable = new Runnable() {
- @Override
- public void run() {
- onSecureCameraActivityStarted();
- }
- };
-
- private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() {
- private boolean mShowing;
-
- @Override
- public void onKeyguardVisibilityChanged(boolean showing) {
- if (mShowing == showing)
- return;
- mShowing = showing;
- CameraWidgetFrame.this.onKeyguardVisibilityChanged(mShowing);
- }
- };
-
- private static final class FixedSizeFrameLayout extends FrameLayout {
- int width;
- int height;
-
- FixedSizeFrameLayout(Context context) {
- super(context);
- }
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- measureChildren(
- MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
- MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
- setMeasuredDimension(width, height);
- }
- }
-
- private CameraWidgetFrame(Context context, Callbacks callbacks,
- KeyguardActivityLauncher activityLauncher,
- CameraWidgetInfo widgetInfo, View previewWidget) {
- super(context);
- mCallbacks = callbacks;
- mActivityLauncher = activityLauncher;
- mWidgetInfo = widgetInfo;
- mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
- KeyguardUpdateMonitor.getInstance(context).registerCallback(mCallback);
-
- mPreview = new FixedSizeFrameLayout(context);
- mPreview.addView(previewWidget);
- addView(mPreview);
-
- View clickBlocker = new View(context);
- clickBlocker.setBackgroundColor(Color.TRANSPARENT);
- clickBlocker.setOnClickListener(this);
- addView(clickBlocker);
-
- setContentDescription(context.getString(R.string.keyguard_accessibility_camera));
- if (DEBUG) Log.d(TAG, "new CameraWidgetFrame instance " + instanceId());
- }
-
- public static CameraWidgetFrame create(Context context, Callbacks callbacks,
- KeyguardActivityLauncher launcher) {
- if (context == null || callbacks == null || launcher == null)
- return null;
-
- CameraWidgetInfo widgetInfo = launcher.getCameraWidgetInfo();
- if (widgetInfo == null)
- return null;
- View previewWidget = getPreviewWidget(context, widgetInfo);
- if (previewWidget == null)
- return null;
-
- return new CameraWidgetFrame(context, callbacks, launcher, widgetInfo, previewWidget);
- }
-
- private static View getPreviewWidget(Context context, CameraWidgetInfo widgetInfo) {
- return widgetInfo.layoutId > 0 ?
- inflateWidgetView(context, widgetInfo) :
- inflateGenericWidgetView(context);
- }
-
- private static View inflateWidgetView(Context context, CameraWidgetInfo widgetInfo) {
- if (DEBUG) Log.d(TAG, "inflateWidgetView: " + widgetInfo.contextPackage);
- View widgetView = null;
- Exception exception = null;
- try {
- Context cameraContext = context.createPackageContext(
- widgetInfo.contextPackage, Context.CONTEXT_RESTRICTED);
- LayoutInflater cameraInflater = (LayoutInflater)
- cameraContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- cameraInflater = cameraInflater.cloneInContext(cameraContext);
- widgetView = cameraInflater.inflate(widgetInfo.layoutId, null, false);
- } catch (NameNotFoundException e) {
- exception = e;
- } catch (RuntimeException e) {
- exception = e;
- }
- if (exception != null) {
- Log.w(TAG, "Error creating camera widget view", exception);
- }
- return widgetView;
- }
-
- private static View inflateGenericWidgetView(Context context) {
- if (DEBUG) Log.d(TAG, "inflateGenericWidgetView");
- ImageView iv = new ImageView(context);
- iv.setImageResource(R.drawable.ic_lockscreen_camera);
- iv.setScaleType(ScaleType.CENTER);
- iv.setBackgroundColor(Color.argb(127, 0, 0, 0));
- return iv;
- }
-
- private void render() {
- final View root = getRootView();
- final int width = root.getWidth() - mInsets.right; // leave room
- final int height = root.getHeight() - mInsets.bottom; // for bars
- if (mRenderedSize.x == width && mRenderedSize.y == height) {
- if (DEBUG) Log.d(TAG, String.format("Already rendered at size=%sx%s %d%%",
- width, height, (int)(100*mPreview.getScaleX())));
- return;
- }
- if (width == 0 || height == 0) {
- return;
- }
-
- mPreview.width = width;
- mPreview.height = height;
- mPreview.requestLayout();
-
- final int thisWidth = getWidth() - getPaddingLeft() - getPaddingRight();
- final int thisHeight = getHeight() - getPaddingTop() - getPaddingBottom();
-
- final float pvScaleX = (float) thisWidth / width;
- final float pvScaleY = (float) thisHeight / height;
- final float pvScale = Math.min(pvScaleX, pvScaleY);
-
- final int pvWidth = (int) (pvScale * width);
- final int pvHeight = (int) (pvScale * height);
-
- final float pvTransX = pvWidth < thisWidth ? (thisWidth - pvWidth) / 2 : 0;
- final float pvTransY = pvHeight < thisHeight ? (thisHeight - pvHeight) / 2 : 0;
-
- final boolean isRtl = mPreview.getLayoutDirection() == LAYOUT_DIRECTION_RTL;
- mPreview.setPivotX(isRtl ? mPreview.width : 0);
- mPreview.setPivotY(0);
- mPreview.setScaleX(pvScale);
- mPreview.setScaleY(pvScale);
- mPreview.setTranslationX((isRtl ? -1 : 1) * pvTransX);
- mPreview.setTranslationY(pvTransY);
-
- mRenderedSize.set(width, height);
- if (DEBUG) Log.d(TAG, String.format("Rendered camera widget size=%sx%s %d%% instance=%s",
- width, height, (int)(100*mPreview.getScaleX()), instanceId()));
- }
-
- private void transitionToCamera() {
- if (mTransitioning || mDown) return;
-
- mTransitioning = true;
-
- enableWindowExitAnimation(false);
-
- final int navHeight = mInsets.bottom;
- final int navWidth = mInsets.right;
-
- mPreview.getLocationInWindow(mTmpLoc);
- final float pvHeight = mPreview.getHeight() * mPreview.getScaleY();
- final float pvCenter = mTmpLoc[1] + pvHeight / 2f;
-
- final ViewGroup root = (ViewGroup) getRootView();
-
- if (DEBUG) {
- Log.d(TAG, "root = " + root.getLeft() + "," + root.getTop() + " "
- + root.getWidth() + "x" + root.getHeight());
- }
-
- if (mFullscreenPreview == null) {
- mFullscreenPreview = getPreviewWidget(mContext, mWidgetInfo);
- mFullscreenPreview.setClickable(false);
- root.addView(mFullscreenPreview, new FrameLayout.LayoutParams(
- root.getWidth() - navWidth,
- root.getHeight() - navHeight));
- }
-
- final float fsHeight = root.getHeight() - navHeight;
- final float fsCenter = root.getTop() + fsHeight / 2;
-
- final float fsScaleY = mPreview.getScaleY();
- final float fsTransY = pvCenter - fsCenter;
- final float fsScaleX = fsScaleY;
-
- mPreview.setVisibility(View.GONE);
- mFullscreenPreview.setVisibility(View.VISIBLE);
- mFullscreenPreview.setTranslationY(fsTransY);
- mFullscreenPreview.setScaleX(fsScaleX);
- mFullscreenPreview.setScaleY(fsScaleY);
- mFullscreenPreview
- .animate()
- .scaleX(1)
- .scaleY(1)
- .translationX(0)
- .translationY(0)
- .setDuration(WIDGET_ANIMATION_DURATION)
- .withEndAction(mPostTransitionToCameraEndAction)
- .start();
-
- if (navHeight > 0 || navWidth > 0) {
- final boolean atBottom = navHeight > 0;
- if (mFakeNavBar == null) {
- mFakeNavBar = new View(mContext);
- mFakeNavBar.setBackgroundColor(Color.BLACK);
- root.addView(mFakeNavBar, new FrameLayout.LayoutParams(
- atBottom ? FrameLayout.LayoutParams.MATCH_PARENT
- : navWidth,
- atBottom ? navHeight
- : FrameLayout.LayoutParams.MATCH_PARENT,
- atBottom ? Gravity.BOTTOM|Gravity.FILL_HORIZONTAL
- : Gravity.RIGHT|Gravity.FILL_VERTICAL));
- mFakeNavBar.setPivotY(navHeight);
- mFakeNavBar.setPivotX(navWidth);
- }
- mFakeNavBar.setAlpha(0f);
- if (atBottom) {
- mFakeNavBar.setScaleY(0.5f);
- } else {
- mFakeNavBar.setScaleX(0.5f);
- }
- mFakeNavBar.setVisibility(View.VISIBLE);
- mFakeNavBar.animate()
- .alpha(1f)
- .scaleY(1f)
- .scaleY(1f)
- .setDuration(WIDGET_ANIMATION_DURATION)
- .start();
- }
- mCallbacks.onLaunchingCamera();
- }
-
- private void recover() {
- if (DEBUG) Log.d(TAG, "recovering at " + SystemClock.uptimeMillis());
- mCallbacks.onCameraLaunchedUnsuccessfully();
- reset();
- }
-
- @Override
- public void setOnLongClickListener(OnLongClickListener l) {
- // ignore
- }
-
- @Override
- public void onClick(View v) {
- if (DEBUG) Log.d(TAG, "clicked");
- if (mTransitioning) return;
- if (mActive) {
- cancelTransitionToCamera();
- transitionToCamera();
- }
- }
-
- @Override
- protected void onDetachedFromWindow() {
- if (DEBUG) Log.d(TAG, "onDetachedFromWindow: instance " + instanceId()
- + " at " + SystemClock.uptimeMillis());
- super.onDetachedFromWindow();
- KeyguardUpdateMonitor.getInstance(mContext).removeCallback(mCallback);
- cancelTransitionToCamera();
- mHandler.removeCallbacks(mRecoverRunnable);
- }
-
- @Override
- public void onActive(boolean isActive) {
- mActive = isActive;
- if (mActive) {
- rescheduleTransitionToCamera();
- } else {
- reset();
- }
- }
-
- @Override
- public boolean onUserInteraction(MotionEvent event) {
- if (mTransitioning) {
- if (DEBUG) Log.d(TAG, "onUserInteraction eaten: mTransitioning");
- return true;
- }
-
- getLocationOnScreen(mTmpLoc);
- int rawBottom = mTmpLoc[1] + getHeight();
- if (event.getRawY() > rawBottom) {
- if (DEBUG) Log.d(TAG, "onUserInteraction eaten: below widget");
- return true;
- }
-
- int action = event.getAction();
- mDown = action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_MOVE;
- if (mActive) {
- rescheduleTransitionToCamera();
- }
- if (DEBUG) Log.d(TAG, "onUserInteraction observed, not eaten");
- return false;
- }
-
- @Override
- protected void onFocusLost() {
- if (DEBUG) Log.d(TAG, "onFocusLost at " + SystemClock.uptimeMillis());
- cancelTransitionToCamera();
- super.onFocusLost();
- }
-
- public void onScreenTurnedOff() {
- if (DEBUG) Log.d(TAG, "onScreenTurnedOff");
- reset();
- }
-
- private void rescheduleTransitionToCamera() {
- if (DEBUG) Log.d(TAG, "rescheduleTransitionToCamera at " + SystemClock.uptimeMillis());
- mHandler.removeCallbacks(mTransitionToCameraRunnable);
- final long duration = mUseFastTransition ? 0 : WIDGET_WAIT_DURATION;
- mHandler.postDelayed(mTransitionToCameraRunnable, duration);
- }
-
- private void cancelTransitionToCamera() {
- if (DEBUG) Log.d(TAG, "cancelTransitionToCamera at " + SystemClock.uptimeMillis());
- mHandler.removeCallbacks(mTransitionToCameraRunnable);
- }
-
- private void onCameraLaunched() {
- mCallbacks.onCameraLaunchedSuccessfully();
- reset();
- }
-
- private void reset() {
- if (DEBUG) Log.d(TAG, "reset at " + SystemClock.uptimeMillis());
- mLaunchCameraStart = 0;
- mTransitioning = false;
- mDown = false;
- cancelTransitionToCamera();
- mHandler.removeCallbacks(mRecoverRunnable);
- mPreview.setVisibility(View.VISIBLE);
- if (mFullscreenPreview != null) {
- mFullscreenPreview.animate().cancel();
- mFullscreenPreview.setVisibility(View.GONE);
- }
- if (mFakeNavBar != null) {
- mFakeNavBar.animate().cancel();
- mFakeNavBar.setVisibility(View.GONE);
- }
- enableWindowExitAnimation(true);
- }
-
- @Override
- protected void onSizeChanged(int w, int h, int oldw, int oldh) {
- if (DEBUG) Log.d(TAG, String.format("onSizeChanged new=%sx%s old=%sx%s at %s",
- w, h, oldw, oldh, SystemClock.uptimeMillis()));
- if ((w != oldw && oldw > 0) || (h != oldh && oldh > 0)) {
- // we can't trust the old geometry anymore; force a re-render
- mRenderedSize.x = mRenderedSize.y = -1;
- }
- mHandler.post(mRenderRunnable);
- super.onSizeChanged(w, h, oldw, oldh);
- }
-
- @Override
- public void onBouncerShowing(boolean showing) {
- if (showing) {
- mTransitioning = false;
- mHandler.post(mRecoverRunnable);
- }
- }
-
- private void enableWindowExitAnimation(boolean isEnabled) {
- View root = getRootView();
- ViewGroup.LayoutParams lp = root.getLayoutParams();
- if (!(lp instanceof WindowManager.LayoutParams))
- return;
- WindowManager.LayoutParams wlp = (WindowManager.LayoutParams) lp;
- int newWindowAnimations = isEnabled ? R.style.Animation_LockScreen : 0;
- if (newWindowAnimations != wlp.windowAnimations) {
- if (DEBUG) Log.d(TAG, "setting windowAnimations to: " + newWindowAnimations
- + " at " + SystemClock.uptimeMillis());
- wlp.windowAnimations = newWindowAnimations;
- mWindowManager.updateViewLayout(root, wlp);
- }
- }
-
- private void onKeyguardVisibilityChanged(boolean showing) {
- if (DEBUG) Log.d(TAG, "onKeyguardVisibilityChanged " + showing
- + " at " + SystemClock.uptimeMillis());
- if (mTransitioning && !showing) {
- mTransitioning = false;
- mHandler.removeCallbacks(mRecoverRunnable);
- if (mLaunchCameraStart > 0) {
- long launchTime = SystemClock.uptimeMillis() - mLaunchCameraStart;
- if (DEBUG) Log.d(TAG, String.format("Camera took %sms to launch", launchTime));
- mLaunchCameraStart = 0;
- onCameraLaunched();
- }
- }
- }
-
- private void onSecureCameraActivityStarted() {
- if (DEBUG) Log.d(TAG, "onSecureCameraActivityStarted at " + SystemClock.uptimeMillis());
- mHandler.postDelayed(mRecoverRunnable, RECOVERY_DELAY);
- }
-
- private String instanceId() {
- return Integer.toHexString(hashCode());
- }
-
- public void setInsets(Rect insets) {
- if (DEBUG) Log.d(TAG, "setInsets: " + insets);
- mInsets.set(insets);
- }
-
- public void setUseFastTransition(boolean useFastTransition) {
- mUseFastTransition = useFastTransition;
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/ChallengeLayout.java b/packages/Keyguard/src/com/android/keyguard/ChallengeLayout.java
deleted file mode 100644
index 2ee21acd..0000000
--- a/packages/Keyguard/src/com/android/keyguard/ChallengeLayout.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-/**
- * Interface implemented by ViewGroup-derived layouts that implement
- * special logic for presenting security challenges to the user.
- */
-public interface ChallengeLayout {
- /**
- * @return true if the security challenge area of this layout is currently visible
- */
- boolean isChallengeShowing();
-
- /**
- * @return true if the challenge area significantly overlaps other content
- */
- boolean isChallengeOverlapping();
-
- /**
- * Show or hide the challenge layout.
- *
- * If you want to show the challenge layout in bouncer mode where applicable,
- * use {@link #showBouncer()} instead.
- *
- * @param b true to show, false to hide
- */
- void showChallenge(boolean show);
-
- /**
- * Show the bouncer challenge. This may block access to other child views.
- */
- void showBouncer();
-
- /**
- * Hide the bouncer challenge if it is currently showing.
- * This may restore previously blocked access to other child views.
- */
- void hideBouncer();
-
- /**
- * Returns true if the challenge is currently in bouncer mode,
- * potentially blocking access to other child views.
- */
- boolean isBouncing();
-
- /**
- * Returns the duration of the bounce animation.
- */
- int getBouncerAnimationDuration();
-
- /**
- * Set a listener that will respond to changes in bouncer state.
- *
- * @param listener listener to register
- */
- void setOnBouncerStateChangedListener(OnBouncerStateChangedListener listener);
-
- /**
- * Listener interface that reports changes in bouncer state.
- * The bouncer is
- */
- public interface OnBouncerStateChangedListener {
- /**
- * Called when the bouncer state changes.
- * The bouncer is activated when the user must pass a security challenge
- * to proceed with the requested action.
- *
- * <p>This differs from simply showing or hiding the security challenge
- * as the bouncer will prevent interaction with other elements of the UI.
- * If the user attempts to escape from the bouncer, it will be dismissed,
- * this method will be called with false as the parameter, and the action
- * should be canceled. If the security component reports a successful
- * authentication and the containing code calls hideBouncer() as a result,
- * this method will also be called with a false parameter. It is up to the
- * caller of hideBouncer to be ready for this.</p>
- *
- * @param bouncerActive true if the bouncer is now active,
- * false if the bouncer was dismissed.
- */
- public void onBouncerStateChanged(boolean bouncerActive);
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/CheckLongPressHelper.java b/packages/Keyguard/src/com/android/keyguard/CheckLongPressHelper.java
deleted file mode 100644
index 52e7cd5..0000000
--- a/packages/Keyguard/src/com/android/keyguard/CheckLongPressHelper.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewConfiguration;
-
-public class CheckLongPressHelper {
- private View mView;
- private boolean mHasPerformedLongPress;
- private CheckForLongPress mPendingCheckForLongPress;
- private float mDownX, mDownY;
- private int mLongPressTimeout;
- private int mScaledTouchSlop;
-
- class CheckForLongPress implements Runnable {
- public void run() {
- if ((mView.getParent() != null) && mView.hasWindowFocus()
- && !mHasPerformedLongPress) {
- if (mView.performLongClick()) {
- mView.setPressed(false);
- mHasPerformedLongPress = true;
- }
- }
- }
- }
-
- public CheckLongPressHelper(View v) {
- mScaledTouchSlop = ViewConfiguration.get(v.getContext()).getScaledTouchSlop();
- mLongPressTimeout = ViewConfiguration.getLongPressTimeout();
- mView = v;
- }
-
- public void postCheckForLongPress(MotionEvent ev) {
- mDownX = ev.getX();
- mDownY = ev.getY();
- mHasPerformedLongPress = false;
-
- if (mPendingCheckForLongPress == null) {
- mPendingCheckForLongPress = new CheckForLongPress();
- }
- mView.postDelayed(mPendingCheckForLongPress, mLongPressTimeout);
- }
-
- public void onMove(MotionEvent ev) {
- float x = ev.getX();
- float y = ev.getY();
- boolean xMoved = Math.abs(mDownX - x) > mScaledTouchSlop;
- boolean yMoved = Math.abs(mDownY - y) > mScaledTouchSlop;
-
- if (xMoved || yMoved) {
- cancelLongPress();
- }
- }
-
- public void cancelLongPress() {
- mHasPerformedLongPress = false;
- if (mPendingCheckForLongPress != null) {
- mView.removeCallbacks(mPendingCheckForLongPress);
- mPendingCheckForLongPress = null;
- }
- }
-
- public boolean hasPerformedLongPress() {
- return mHasPerformedLongPress;
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java b/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java
deleted file mode 100644
index 8d13ac2..0000000
--- a/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import com.android.internal.policy.IFaceLockCallback;
-import com.android.internal.policy.IFaceLockInterface;
-import com.android.internal.widget.LockPatternUtils;
-
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Looper;
-import android.os.Message;
-import android.os.PowerManager;
-import android.os.RemoteException;
-import android.os.UserHandle;
-import android.util.Log;
-import android.view.View;
-
-public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
-
- private static final boolean DEBUG = KeyguardConstants.DEBUG;
- private static final String TAG = "FULLockscreen";
- private static final String FACE_LOCK_PACKAGE = "com.android.facelock";
-
- private final Context mContext;
- private final LockPatternUtils mLockPatternUtils;
-
- // TODO: is mServiceRunning needed or can we just use mIsRunning or check if mService is null?
- private boolean mServiceRunning = false;
- // TODO: now that the code has been restructure to do almost all operations from a handler, this
- // lock may no longer be necessary.
- private final Object mServiceRunningLock = new Object();
- private IFaceLockInterface mService;
- private boolean mBoundToService = false;
- private View mFaceUnlockView;
-
- private Handler mHandler;
- private final int MSG_SERVICE_CONNECTED = 0;
- private final int MSG_SERVICE_DISCONNECTED = 1;
- private final int MSG_UNLOCK = 2;
- private final int MSG_CANCEL = 3;
- private final int MSG_REPORT_FAILED_ATTEMPT = 4;
- private final int MSG_POKE_WAKELOCK = 5;
-
- // TODO: This was added for the purpose of adhering to what the biometric interface expects
- // the isRunning() function to return. However, it is probably not necessary to have both
- // mRunning and mServiceRunning. I'd just rather wait to change that logic.
- private volatile boolean mIsRunning = false;
-
- KeyguardSecurityCallback mKeyguardScreenCallback;
-
- /**
- * Stores some of the structures that Face Unlock will need to access and creates the handler
- * will be used to execute messages on the UI thread.
- */
- public FaceUnlock(Context context) {
- mContext = context;
- mLockPatternUtils = new LockPatternUtils(context);
- mHandler = new Handler(this);
- }
-
- public void setKeyguardCallback(KeyguardSecurityCallback keyguardScreenCallback) {
- mKeyguardScreenCallback = keyguardScreenCallback;
- }
-
- /**
- * Stores and displays the view that Face Unlock is allowed to draw within.
- * TODO: since the layout object will eventually be shared by multiple biometric unlock
- * methods, we will have to add our other views (background, cancel button) here.
- */
- public void initializeView(View biometricUnlockView) {
- Log.d(TAG, "initializeView()");
- mFaceUnlockView = biometricUnlockView;
- }
-
- /**
- * Indicates whether Face Unlock is currently running.
- */
- public boolean isRunning() {
- return mIsRunning;
- }
-
- /**
- * Dismisses face unlock and goes to the backup lock
- */
- public void stopAndShowBackup() {
- if (DEBUG) Log.d(TAG, "stopAndShowBackup()");
- mHandler.sendEmptyMessage(MSG_CANCEL);
- }
-
- /**
- * Binds to the Face Unlock service. Face Unlock will be started when the bind completes. The
- * Face Unlock view is displayed to hide the backup lock while the service is starting up.
- * Called on the UI thread.
- */
- public boolean start() {
- if (DEBUG) Log.d(TAG, "start()");
- if (mHandler.getLooper() != Looper.myLooper()) {
- Log.e(TAG, "start() called off of the UI thread");
- }
-
- if (mIsRunning) {
- Log.w(TAG, "start() called when already running");
- }
-
- if (!mBoundToService) {
- Log.d(TAG, "Binding to Face Unlock service for user="
- + mLockPatternUtils.getCurrentUser());
- mContext.bindServiceAsUser(
- new Intent(IFaceLockInterface.class.getName()).setPackage(FACE_LOCK_PACKAGE),
- mConnection,
- Context.BIND_AUTO_CREATE,
- new UserHandle(mLockPatternUtils.getCurrentUser()));
- mBoundToService = true;
- } else {
- Log.w(TAG, "Attempt to bind to Face Unlock when already bound");
- }
-
- mIsRunning = true;
- return true;
- }
-
- /**
- * Stops Face Unlock and unbinds from the service. Called on the UI thread.
- */
- public boolean stop() {
- if (DEBUG) Log.d(TAG, "stop()");
- if (mHandler.getLooper() != Looper.myLooper()) {
- Log.e(TAG, "stop() called from non-UI thread");
- }
-
- // Clearing any old service connected messages.
- mHandler.removeMessages(MSG_SERVICE_CONNECTED);
-
- boolean mWasRunning = mIsRunning;
-
- stopUi();
-
- if (mBoundToService) {
- if (mService != null) {
- try {
- mService.unregisterCallback(mFaceUnlockCallback);
- } catch (RemoteException e) {
- // Not much we can do
- }
- }
- Log.d(TAG, "Unbinding from Face Unlock service");
- mContext.unbindService(mConnection);
- mBoundToService = false;
- } else {
- // This is usually not an error when this happens. Sometimes we will tell it to
- // unbind multiple times because it's called from both onWindowFocusChanged and
- // onDetachedFromWindow.
- if (DEBUG) Log.d(TAG, "Attempt to unbind from Face Unlock when not bound");
- }
- mIsRunning = false;
- return mWasRunning;
- }
-
- /**
- * Frees up resources used by Face Unlock and stops it if it is still running.
- */
- public void cleanUp() {
- if (DEBUG) Log.d(TAG, "cleanUp()");
- if (mService != null) {
- try {
- mService.unregisterCallback(mFaceUnlockCallback);
- } catch (RemoteException e) {
- // Not much we can do
- }
- stopUi();
- mService = null;
- }
- }
-
- /**
- * Returns the Device Policy Manager quality for Face Unlock, which is BIOMETRIC_WEAK.
- */
- public int getQuality() {
- return DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK;
- }
-
- /**
- * Handles messages such that everything happens on the UI thread in a deterministic order.
- * Calls from the Face Unlock service come from binder threads. Calls from lockscreen typically
- * come from the UI thread. This makes sure there are no race conditions between those calls.
- */
- public boolean handleMessage(Message msg) {
- switch (msg.what) {
- case MSG_SERVICE_CONNECTED:
- handleServiceConnected();
- break;
- case MSG_SERVICE_DISCONNECTED:
- handleServiceDisconnected();
- break;
- case MSG_UNLOCK:
- handleUnlock(msg.arg1);
- break;
- case MSG_CANCEL:
- handleCancel();
- break;
- case MSG_REPORT_FAILED_ATTEMPT:
- handleReportFailedAttempt();
- break;
- case MSG_POKE_WAKELOCK:
- handlePokeWakelock(msg.arg1);
- break;
- default:
- Log.e(TAG, "Unhandled message");
- return false;
- }
- return true;
- }
-
- /**
- * Tells the service to start its UI via an AIDL interface. Called when the
- * onServiceConnected() callback is received.
- */
- void handleServiceConnected() {
- Log.d(TAG, "handleServiceConnected()");
-
- // It is possible that an unbind has occurred in the time between the bind and when this
- // function is reached. If an unbind has already occurred, proceeding on to call startUi()
- // can result in a fatal error. Note that the onServiceConnected() callback is
- // asynchronous, so this possibility would still exist if we executed this directly in
- // onServiceConnected() rather than using a handler.
- if (!mBoundToService) {
- Log.d(TAG, "Dropping startUi() in handleServiceConnected() because no longer bound");
- return;
- }
-
- try {
- mService.registerCallback(mFaceUnlockCallback);
- } catch (RemoteException e) {
- Log.e(TAG, "Caught exception connecting to Face Unlock: " + e.toString());
- mService = null;
- mBoundToService = false;
- mIsRunning = false;
- return;
- }
-
- if (mFaceUnlockView != null) {
- IBinder windowToken = mFaceUnlockView.getWindowToken();
- if (windowToken != null) {
- // When switching between portrait and landscape view while Face Unlock is running,
- // the screen will eventually go dark unless we poke the wakelock when Face Unlock
- // is restarted.
- mKeyguardScreenCallback.userActivity();
-
- int[] position;
- position = new int[2];
- mFaceUnlockView.getLocationInWindow(position);
- startUi(windowToken, position[0], position[1], mFaceUnlockView.getWidth(),
- mFaceUnlockView.getHeight());
- } else {
- Log.e(TAG, "windowToken is null in handleServiceConnected()");
- }
- }
- }
-
- /**
- * Called when the onServiceDisconnected() callback is received. This should not happen during
- * normal operation. It indicates an error has occurred.
- */
- void handleServiceDisconnected() {
- Log.e(TAG, "handleServiceDisconnected()");
- // TODO: this lock may no longer be needed now that everything is being called from a
- // handler
- synchronized (mServiceRunningLock) {
- mService = null;
- mServiceRunning = false;
- }
- mBoundToService = false;
- mIsRunning = false;
- }
-
- /**
- * Stops the Face Unlock service and tells the device to grant access to the user.
- */
- void handleUnlock(int authenticatedUserId) {
- if (DEBUG) Log.d(TAG, "handleUnlock()");
- stop();
- int currentUserId = mLockPatternUtils.getCurrentUser();
- if (authenticatedUserId == currentUserId) {
- if (DEBUG) Log.d(TAG, "Unlocking for user " + authenticatedUserId);
- mKeyguardScreenCallback.reportUnlockAttempt(true);
- mKeyguardScreenCallback.dismiss(true);
- } else {
- Log.d(TAG, "Ignoring unlock for authenticated user (" + authenticatedUserId +
- ") because the current user is " + currentUserId);
- }
- }
-
- /**
- * Stops the Face Unlock service and goes to the backup lock.
- */
- void handleCancel() {
- if (DEBUG) Log.d(TAG, "handleCancel()");
- // We are going to the backup method, so we don't want to see Face Unlock again until the
- // next time the user visits keyguard.
- KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(false);
-
- mKeyguardScreenCallback.showBackupSecurity();
- stop();
- mKeyguardScreenCallback.userActivity();
- }
-
- /**
- * Increments the number of failed Face Unlock attempts.
- */
- void handleReportFailedAttempt() {
- if (DEBUG) Log.d(TAG, "handleReportFailedAttempt()");
- // We are going to the backup method, so we don't want to see Face Unlock again until the
- // next time the user visits keyguard.
- KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(false);
-
- mKeyguardScreenCallback.reportUnlockAttempt(false);
- }
-
- /**
- * If the screen is on, pokes the wakelock to keep the screen alive and active for a specific
- * amount of time.
- */
- void handlePokeWakelock(int millis) {
- PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
- if (powerManager.isScreenOn()) {
- mKeyguardScreenCallback.userActivity();
- }
- }
-
- /**
- * Implements service connection methods.
- */
- private ServiceConnection mConnection = new ServiceConnection() {
- /**
- * Called when the Face Unlock service connects after calling bind().
- */
- public void onServiceConnected(ComponentName className, IBinder iservice) {
- Log.d(TAG, "Connected to Face Unlock service");
- mService = IFaceLockInterface.Stub.asInterface(iservice);
- mHandler.sendEmptyMessage(MSG_SERVICE_CONNECTED);
- }
-
- /**
- * Called if the Face Unlock service unexpectedly disconnects. This indicates an error.
- */
- public void onServiceDisconnected(ComponentName className) {
- Log.e(TAG, "Unexpected disconnect from Face Unlock service");
- mHandler.sendEmptyMessage(MSG_SERVICE_DISCONNECTED);
- }
- };
-
- /**
- * Tells the Face Unlock service to start displaying its UI and start processing.
- */
- private void startUi(IBinder windowToken, int x, int y, int w, int h) {
- if (DEBUG) Log.d(TAG, "startUi()");
- synchronized (mServiceRunningLock) {
- if (!mServiceRunning) {
- Log.d(TAG, "Starting Face Unlock");
- try {
- mService.startUi(windowToken, x, y, w, h,
- mLockPatternUtils.isBiometricWeakLivelinessEnabled());
- } catch (RemoteException e) {
- Log.e(TAG, "Caught exception starting Face Unlock: " + e.toString());
- return;
- }
- mServiceRunning = true;
- } else {
- Log.w(TAG, "startUi() attempted while running");
- }
- }
- }
-
- /**
- * Tells the Face Unlock service to stop displaying its UI and stop processing.
- */
- private void stopUi() {
- if (DEBUG) Log.d(TAG, "stopUi()");
- // Note that attempting to stop Face Unlock when it's not running is not an issue.
- // Face Unlock can return, which stops it and then we try to stop it when the
- // screen is turned off. That's why we check.
- synchronized (mServiceRunningLock) {
- if (mServiceRunning) {
- Log.d(TAG, "Stopping Face Unlock");
- try {
- mService.stopUi();
- } catch (RemoteException e) {
- Log.e(TAG, "Caught exception stopping Face Unlock: " + e.toString());
- }
- mServiceRunning = false;
- } else {
- // This is usually not an error when this happens. Sometimes we will tell it to
- // stop multiple times because it's called from both onWindowFocusChanged and
- // onDetachedFromWindow.
- if (DEBUG) Log.d(TAG, "stopUi() attempted while not running");
- }
- }
- }
-
- /**
- * Implements the AIDL biometric unlock service callback interface.
- */
- private final IFaceLockCallback mFaceUnlockCallback = new IFaceLockCallback.Stub() {
- /**
- * Called when Face Unlock wants to grant access to the user.
- */
- public void unlock() {
- if (DEBUG) Log.d(TAG, "unlock()");
- Message message = mHandler.obtainMessage(MSG_UNLOCK, UserHandle.getCallingUserId(), -1);
- mHandler.sendMessage(message);
- }
-
- /**
- * Called when Face Unlock wants to go to the backup.
- */
- public void cancel() {
- if (DEBUG) Log.d(TAG, "cancel()");
- mHandler.sendEmptyMessage(MSG_CANCEL);
- }
-
- /**
- * Called when Face Unlock wants to increment the number of failed attempts.
- */
- public void reportFailedAttempt() {
- if (DEBUG) Log.d(TAG, "reportFailedAttempt()");
- mHandler.sendEmptyMessage(MSG_REPORT_FAILED_ATTEMPT);
- }
-
- /**
- * Called when Face Unlock wants to keep the screen alive and active for a specific amount
- * of time.
- */
- public void pokeWakelock(int millis) {
- if (DEBUG) Log.d(TAG, "pokeWakelock() for " + millis + "ms");
- Message message = mHandler.obtainMessage(MSG_POKE_WAKELOCK, millis, -1);
- mHandler.sendMessage(message);
- }
-
- };
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
index a411df3..b03176c 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
@@ -37,7 +37,6 @@
protected LockPatternUtils mLockPatternUtils;
protected SecurityMessageDisplay mSecurityMessageDisplay;
protected View mEcaView;
- private Drawable mBouncerFrame;
protected boolean mEnableHaptics;
// To avoid accidental lockout due to events while the device in in the pocket, ignore
@@ -86,10 +85,6 @@
mLockPatternUtils = new LockPatternUtils(mContext);
mSecurityMessageDisplay = new KeyguardMessageArea.Helper(this);
mEcaView = findViewById(R.id.keyguard_selector_fade_container);
- View bouncerFrameView = findViewById(R.id.keyguard_bouncer_frame);
- if (bouncerFrameView != null) {
- mBouncerFrame = bouncerFrameView.getBackground();
- }
}
/*
@@ -183,18 +178,6 @@
}
@Override
- public void showBouncer(int duration) {
- KeyguardSecurityViewHelper.
- showBouncer(mSecurityMessageDisplay, mEcaView, mBouncerFrame, duration);
- }
-
- @Override
- public void hideBouncer(int duration) {
- KeyguardSecurityViewHelper.
- hideBouncer(mSecurityMessageDisplay, mEcaView, mBouncerFrame, duration);
- }
-
- @Override
public boolean startDisappearAnimation(Runnable finishRunnable) {
return false;
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardAccountView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardAccountView.java
deleted file mode 100644
index 5cb3b9b..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardAccountView.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.keyguard;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.accounts.AccountManagerCallback;
-import android.accounts.AccountManagerFuture;
-import android.accounts.AuthenticatorException;
-import android.accounts.OperationCanceledException;
-import android.app.Dialog;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Rect;
-import android.os.Bundle;
-import android.os.UserHandle;
-import android.text.Editable;
-import android.text.InputFilter;
-import android.text.LoginFilter;
-import android.text.TextWatcher;
-import android.util.AttributeSet;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.WindowManager;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-
-import com.android.internal.widget.LockPatternUtils;
-
-import java.io.IOException;
-
-/**
- * When the user forgets their password a bunch of times, we fall back on their
- * account's login/password to unlock the phone (and reset their lock pattern).
- */
-public class KeyguardAccountView extends LinearLayout implements KeyguardSecurityView,
- View.OnClickListener, TextWatcher {
- private static final String LOCK_PATTERN_PACKAGE = "com.android.settings";
- private static final String LOCK_PATTERN_CLASS = LOCK_PATTERN_PACKAGE + ".ChooseLockGeneric";
-
- private KeyguardSecurityCallback mCallback;
- private LockPatternUtils mLockPatternUtils;
- private EditText mLogin;
- private EditText mPassword;
- private Button mOk;
- public boolean mEnableFallback;
- private SecurityMessageDisplay mSecurityMessageDisplay;
-
- /**
- * Shown while making asynchronous check of password.
- */
- private ProgressDialog mCheckingDialog;
-
- public KeyguardAccountView(Context context) {
- this(context, null, 0);
- }
-
- public KeyguardAccountView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public KeyguardAccountView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- mLockPatternUtils = new LockPatternUtils(getContext());
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
-
- mLogin = (EditText) findViewById(R.id.login);
- mLogin.setFilters(new InputFilter[] { new LoginFilter.UsernameFilterGeneric() } );
- mLogin.addTextChangedListener(this);
-
- mPassword = (EditText) findViewById(R.id.password);
- mPassword.addTextChangedListener(this);
-
- mOk = (Button) findViewById(R.id.ok);
- mOk.setOnClickListener(this);
-
- mSecurityMessageDisplay = new KeyguardMessageArea.Helper(this);
- reset();
- }
-
- public void setKeyguardCallback(KeyguardSecurityCallback callback) {
- mCallback = callback;
- }
-
- public void setLockPatternUtils(LockPatternUtils utils) {
- mLockPatternUtils = utils;
- }
-
- public KeyguardSecurityCallback getCallback() {
- return mCallback;
- }
-
-
- public void afterTextChanged(Editable s) {
- }
-
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
-
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- if (mCallback != null) {
- mCallback.userActivity();
- }
- }
-
- @Override
- protected boolean onRequestFocusInDescendants(int direction,
- Rect previouslyFocusedRect) {
- // send focus to the login field
- return mLogin.requestFocus(direction, previouslyFocusedRect);
- }
-
- public boolean needsInput() {
- return true;
- }
-
- public void reset() {
- // start fresh
- mLogin.setText("");
- mPassword.setText("");
- mLogin.requestFocus();
- boolean permLocked = mLockPatternUtils.isPermanentlyLocked();
- mSecurityMessageDisplay.setMessage(permLocked ? R.string.kg_login_too_many_attempts :
- R.string.kg_login_instructions, permLocked ? true : false);
- }
-
- /** {@inheritDoc} */
- public void cleanUp() {
- if (mCheckingDialog != null) {
- mCheckingDialog.hide();
- }
- mCallback = null;
- mLockPatternUtils = null;
- }
-
- public void onClick(View v) {
- mCallback.userActivity();
- if (v == mOk) {
- asyncCheckPassword();
- }
- }
-
- private void postOnCheckPasswordResult(final boolean success) {
- // ensure this runs on UI thread
- mLogin.post(new Runnable() {
- public void run() {
- if (success) {
- // clear out forgotten password
- mLockPatternUtils.setPermanentlyLocked(false);
- mLockPatternUtils.setLockPatternEnabled(false);
- mLockPatternUtils.saveLockPattern(null);
-
- // launch the 'choose lock pattern' activity so
- // the user can pick a new one if they want to
- Intent intent = new Intent();
- intent.setClassName(LOCK_PATTERN_PACKAGE, LOCK_PATTERN_CLASS);
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- mContext.startActivityAsUser(intent,
- new UserHandle(mLockPatternUtils.getCurrentUser()));
- mCallback.reportUnlockAttempt(true);
-
- // dismiss keyguard
- mCallback.dismiss(true);
- } else {
- mSecurityMessageDisplay.setMessage(R.string.kg_login_invalid_input, true);
- mPassword.setText("");
- mCallback.reportUnlockAttempt(false);
- }
- }
- });
- }
-
- @Override
- public boolean dispatchKeyEvent(KeyEvent event) {
- if (event.getAction() == KeyEvent.ACTION_DOWN
- && event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
- if (mLockPatternUtils.isPermanentlyLocked()) {
- mCallback.dismiss(false);
- } else {
- // TODO: mCallback.forgotPattern(false);
- }
- return true;
- }
- return super.dispatchKeyEvent(event);
- }
-
- /**
- * Given the string the user entered in the 'username' field, find
- * the stored account that they probably intended. Prefer, in order:
- *
- * - an exact match for what was typed, or
- * - a case-insensitive match for what was typed, or
- * - if they didn't include a domain, an exact match of the username, or
- * - if they didn't include a domain, a case-insensitive
- * match of the username.
- *
- * If there is a tie for the best match, choose neither --
- * the user needs to be more specific.
- *
- * @return an account name from the database, or null if we can't
- * find a single best match.
- */
- private Account findIntendedAccount(String username) {
- Account[] accounts = AccountManager.get(mContext).getAccountsByTypeAsUser("com.google",
- new UserHandle(mLockPatternUtils.getCurrentUser()));
-
- // Try to figure out which account they meant if they
- // typed only the username (and not the domain), or got
- // the case wrong.
-
- Account bestAccount = null;
- int bestScore = 0;
- for (Account a: accounts) {
- int score = 0;
- if (username.equals(a.name)) {
- score = 4;
- } else if (username.equalsIgnoreCase(a.name)) {
- score = 3;
- } else if (username.indexOf('@') < 0) {
- int i = a.name.indexOf('@');
- if (i >= 0) {
- String aUsername = a.name.substring(0, i);
- if (username.equals(aUsername)) {
- score = 2;
- } else if (username.equalsIgnoreCase(aUsername)) {
- score = 1;
- }
- }
- }
- if (score > bestScore) {
- bestAccount = a;
- bestScore = score;
- } else if (score == bestScore) {
- bestAccount = null;
- }
- }
- return bestAccount;
- }
-
- private void asyncCheckPassword() {
- mCallback.userActivity();
- final String login = mLogin.getText().toString();
- final String password = mPassword.getText().toString();
- Account account = findIntendedAccount(login);
- if (account == null) {
- postOnCheckPasswordResult(false);
- return;
- }
- getProgressDialog().show();
- Bundle options = new Bundle();
- options.putString(AccountManager.KEY_PASSWORD, password);
- AccountManager.get(mContext).confirmCredentialsAsUser(account, options, null /* activity */,
- new AccountManagerCallback<Bundle>() {
- public void run(AccountManagerFuture<Bundle> future) {
- try {
- mCallback.userActivity();
- final Bundle result = future.getResult();
- final boolean verified = result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT);
- postOnCheckPasswordResult(verified);
- } catch (OperationCanceledException e) {
- postOnCheckPasswordResult(false);
- } catch (IOException e) {
- postOnCheckPasswordResult(false);
- } catch (AuthenticatorException e) {
- postOnCheckPasswordResult(false);
- } finally {
- mLogin.post(new Runnable() {
- public void run() {
- getProgressDialog().hide();
- }
- });
- }
- }
- }, null /* handler */, new UserHandle(mLockPatternUtils.getCurrentUser()));
- }
-
- private Dialog getProgressDialog() {
- if (mCheckingDialog == null) {
- mCheckingDialog = new ProgressDialog(mContext);
- mCheckingDialog.setMessage(
- mContext.getString(R.string.kg_login_checking_password));
- mCheckingDialog.setIndeterminate(true);
- mCheckingDialog.setCancelable(false);
- mCheckingDialog.getWindow().setType(
- WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
- }
- return mCheckingDialog;
- }
-
- @Override
- public void onPause() {
-
- }
-
- @Override
- public void onResume(int reason) {
- reset();
- }
-
- @Override
- public void showUsabilityHint() {
- }
-
- @Override
- public void showBouncer(int duration) {
- }
-
- @Override
- public void hideBouncer(int duration) {
- }
-
- @Override
- public void startAppearAnimation() {
- // TODO.
- }
-
- @Override
- public boolean startDisappearAnimation(Runnable finishRunnable) {
- return false;
- }
-}
-
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java b/packages/Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java
deleted file mode 100644
index 1978ded..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import com.android.internal.widget.LockPatternUtils;
-
-import android.app.ActivityManagerNative;
-import android.app.ActivityOptions;
-import android.app.IActivityManager.WaitResult;
-import android.appwidget.AppWidgetManager;
-import android.appwidget.AppWidgetProviderInfo;
-import android.content.ActivityNotFoundException;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.RemoteException;
-import android.os.SystemClock;
-import android.os.UserHandle;
-import android.provider.MediaStore;
-import android.util.Log;
-import android.view.WindowManager;
-import android.view.WindowManagerGlobal;
-
-import com.android.keyguard.KeyguardHostView.OnDismissAction;
-
-import java.util.List;
-
-public abstract class KeyguardActivityLauncher {
- private static final String TAG = KeyguardActivityLauncher.class.getSimpleName();
- private static final boolean DEBUG = KeyguardConstants.DEBUG;
- private static final String META_DATA_KEYGUARD_LAYOUT = "com.android.keyguard.layout";
- private static final Intent SECURE_CAMERA_INTENT =
- new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE)
- .addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
- private static final Intent INSECURE_CAMERA_INTENT =
- new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
-
- abstract Context getContext();
-
- abstract LockPatternUtils getLockPatternUtils();
-
- abstract void setOnDismissAction(OnDismissAction action);
-
- abstract void requestDismissKeyguard();
-
- public static class CameraWidgetInfo {
- public String contextPackage;
- public int layoutId;
- }
-
- public CameraWidgetInfo getCameraWidgetInfo() {
- CameraWidgetInfo info = new CameraWidgetInfo();
- Intent intent = getCameraIntent();
- PackageManager packageManager = getContext().getPackageManager();
- final List<ResolveInfo> appList = packageManager.queryIntentActivitiesAsUser(
- intent, PackageManager.MATCH_DEFAULT_ONLY, getLockPatternUtils().getCurrentUser());
- if (appList.size() == 0) {
- if (DEBUG) Log.d(TAG, "getCameraWidgetInfo(): Nothing found");
- return null;
- }
- ResolveInfo resolved = packageManager.resolveActivityAsUser(intent,
- PackageManager.MATCH_DEFAULT_ONLY | PackageManager.GET_META_DATA,
- getLockPatternUtils().getCurrentUser());
- if (DEBUG) Log.d(TAG, "getCameraWidgetInfo(): resolved: " + resolved);
- if (wouldLaunchResolverActivity(resolved, appList)) {
- if (DEBUG) Log.d(TAG, "getCameraWidgetInfo(): Would launch resolver");
- return info;
- }
- if (resolved == null || resolved.activityInfo == null) {
- return null;
- }
- if (resolved.activityInfo.metaData == null || resolved.activityInfo.metaData.isEmpty()) {
- if (DEBUG) Log.d(TAG, "getCameraWidgetInfo(): no metadata found");
- return info;
- }
- int layoutId = resolved.activityInfo.metaData.getInt(META_DATA_KEYGUARD_LAYOUT);
- if (layoutId == 0) {
- if (DEBUG) Log.d(TAG, "getCameraWidgetInfo(): no layout specified");
- return info;
- }
- info.contextPackage = resolved.activityInfo.packageName;
- info.layoutId = layoutId;
- return info;
- }
-
- public void launchCamera(Handler worker, Runnable onSecureCameraStarted) {
- LockPatternUtils lockPatternUtils = getLockPatternUtils();
-
- // Workaround to avoid camera release/acquisition race when resuming face unlock
- // after showing lockscreen camera (bug 11063890).
- KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(getContext());
- updateMonitor.setAlternateUnlockEnabled(false);
-
- if (mustLaunchSecurely()) {
- // Launch the secure version of the camera
- if (wouldLaunchResolverActivity(SECURE_CAMERA_INTENT)) {
- // TODO: Show disambiguation dialog instead.
- // For now, we'll treat this like launching any other app from secure keyguard.
- // When they do, user sees the system's ResolverActivity which lets them choose
- // which secure camera to use.
- launchActivity(SECURE_CAMERA_INTENT, false, false, null, null);
- } else {
- launchActivity(SECURE_CAMERA_INTENT, true, false, worker, onSecureCameraStarted);
- }
- } else {
- // Launch the normal camera
- launchActivity(INSECURE_CAMERA_INTENT, false, false, null, null);
- }
- }
-
- private boolean mustLaunchSecurely() {
- LockPatternUtils lockPatternUtils = getLockPatternUtils();
- KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(getContext());
- int currentUser = lockPatternUtils.getCurrentUser();
- return lockPatternUtils.isSecure() && !updateMonitor.getUserHasTrust(currentUser);
- }
-
- public void launchWidgetPicker(int appWidgetId) {
- Intent pickIntent = new Intent(AppWidgetManager.ACTION_KEYGUARD_APPWIDGET_PICK);
-
- pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
- pickIntent.putExtra(AppWidgetManager.EXTRA_CUSTOM_SORT, false);
- pickIntent.putExtra(AppWidgetManager.EXTRA_CATEGORY_FILTER,
- AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD);
-
- Bundle options = new Bundle();
- options.putInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY,
- AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD);
- pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS, options);
- pickIntent.addFlags(
- Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_SINGLE_TOP
- | Intent.FLAG_ACTIVITY_CLEAR_TOP
- | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
-
- launchActivity(pickIntent, false, false, null, null);
- }
-
- /**
- * Launches the said intent for the current foreground user.
- *
- * @param intent
- * @param showsWhileLocked true if the activity can be run on top of keyguard.
- * See {@link WindowManager#FLAG_SHOW_WHEN_LOCKED}
- * @param useDefaultAnimations true if default transitions should be used, else suppressed.
- * @param worker if supplied along with onStarted, used to launch the blocking activity call.
- * @param onStarted if supplied along with worker, called after activity is started.
- */
- public void launchActivity(final Intent intent,
- boolean showsWhileLocked,
- boolean useDefaultAnimations,
- final Handler worker,
- final Runnable onStarted) {
-
- final Context context = getContext();
- final Bundle animation = useDefaultAnimations ? null
- : ActivityOptions.makeCustomAnimation(context, 0, 0).toBundle();
- launchActivityWithAnimation(intent, showsWhileLocked, animation, worker, onStarted);
- }
-
- public void launchActivityWithAnimation(final Intent intent,
- boolean showsWhileLocked,
- final Bundle animation,
- final Handler worker,
- final Runnable onStarted) {
-
- LockPatternUtils lockPatternUtils = getLockPatternUtils();
- intent.addFlags(
- Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_SINGLE_TOP
- | Intent.FLAG_ACTIVITY_CLEAR_TOP);
- boolean mustLaunchSecurely = mustLaunchSecurely();
- if (!mustLaunchSecurely || showsWhileLocked) {
- if (!mustLaunchSecurely) {
- dismissKeyguardOnNextActivity();
- }
- try {
- if (DEBUG) Log.d(TAG, String.format("Starting activity for intent %s at %s",
- intent, SystemClock.uptimeMillis()));
- startActivityForCurrentUser(intent, animation, worker, onStarted);
- } catch (ActivityNotFoundException e) {
- Log.w(TAG, "Activity not found for intent + " + intent.getAction());
- }
- } else {
- // Create a runnable to start the activity and ask the user to enter their
- // credentials.
- setOnDismissAction(new OnDismissAction() {
- @Override
- public boolean onDismiss() {
- dismissKeyguardOnNextActivity();
- startActivityForCurrentUser(intent, animation, worker, onStarted);
- return true;
- }
- });
- requestDismissKeyguard();
- }
- }
-
- private void dismissKeyguardOnNextActivity() {
- try {
- WindowManagerGlobal.getWindowManagerService().dismissKeyguard();
- } catch (RemoteException e) {
- Log.w(TAG, "Error dismissing keyguard", e);
- }
- }
-
- private void startActivityForCurrentUser(final Intent intent, final Bundle options,
- Handler worker, final Runnable onStarted) {
- final UserHandle user = new UserHandle(UserHandle.USER_CURRENT);
- if (worker == null || onStarted == null) {
- getContext().startActivityAsUser(intent, options, user);
- return;
- }
- // if worker + onStarted are supplied, run blocking activity launch call in the background
- worker.post(new Runnable(){
- @Override
- public void run() {
- try {
- WaitResult result = ActivityManagerNative.getDefault().startActivityAndWait(
- null /*caller*/,
- null /*caller pkg*/,
- intent,
- intent.resolveTypeIfNeeded(getContext().getContentResolver()),
- null /*resultTo*/,
- null /*resultWho*/,
- 0 /*requestCode*/,
- Intent.FLAG_ACTIVITY_NEW_TASK,
- null /*profilerInfo*/,
- options,
- user.getIdentifier());
- if (DEBUG) Log.d(TAG, String.format("waitResult[%s,%s,%s,%s] at %s",
- result.result, result.thisTime, result.totalTime, result.who,
- SystemClock.uptimeMillis()));
- } catch (RemoteException e) {
- Log.w(TAG, "Error starting activity", e);
- return;
- }
- try {
- onStarted.run();
- } catch (Throwable t) {
- Log.w(TAG, "Error running onStarted callback", t);
- }
- }});
- }
-
- private Intent getCameraIntent() {
- return mustLaunchSecurely() ? SECURE_CAMERA_INTENT : INSECURE_CAMERA_INTENT;
- }
-
- private boolean wouldLaunchResolverActivity(Intent intent) {
- PackageManager packageManager = getContext().getPackageManager();
- ResolveInfo resolved = packageManager.resolveActivityAsUser(intent,
- PackageManager.MATCH_DEFAULT_ONLY, getLockPatternUtils().getCurrentUser());
- List<ResolveInfo> appList = packageManager.queryIntentActivitiesAsUser(
- intent, PackageManager.MATCH_DEFAULT_ONLY, getLockPatternUtils().getCurrentUser());
- return wouldLaunchResolverActivity(resolved, appList);
- }
-
- private boolean wouldLaunchResolverActivity(ResolveInfo resolved, List<ResolveInfo> appList) {
- // If the list contains the above resolved activity, then it can't be
- // ResolverActivity itself.
- for (int i = 0; i < appList.size(); i++) {
- ResolveInfo tmp = appList.get(i);
- if (tmp.activityInfo.name.equals(resolved.activityInfo.name)
- && tmp.activityInfo.packageName.equals(resolved.activityInfo.packageName)) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardCircleFramedDrawable.java b/packages/Keyguard/src/com/android/keyguard/KeyguardCircleFramedDrawable.java
deleted file mode 100644
index 0e08cf4..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardCircleFramedDrawable.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.ColorFilter;
-import android.graphics.Paint;
-import android.graphics.Path;
-import android.graphics.PixelFormat;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffXfermode;
-import android.graphics.Rect;
-import android.graphics.RectF;
-import android.graphics.drawable.Drawable;
-
-class KeyguardCircleFramedDrawable extends Drawable {
-
- private final Bitmap mBitmap;
- private final int mSize;
- private final Paint mPaint;
- private final float mShadowRadius;
- private final float mStrokeWidth;
- private final int mFrameColor;
- private final int mHighlightColor;
- private final int mFrameShadowColor;
-
- private float mScale;
- private Path mFramePath;
- private Rect mSrcRect;
- private RectF mDstRect;
- private RectF mFrameRect;
- private boolean mPressed;
-
- public KeyguardCircleFramedDrawable(Bitmap bitmap, int size,
- int frameColor, float strokeWidth,
- int frameShadowColor, float shadowRadius,
- int highlightColor) {
- super();
- mSize = size;
- mShadowRadius = shadowRadius;
- mFrameColor = frameColor;
- mFrameShadowColor = frameShadowColor;
- mStrokeWidth = strokeWidth;
- mHighlightColor = highlightColor;
-
- mBitmap = Bitmap.createBitmap(mSize, mSize, Bitmap.Config.ARGB_8888);
- final Canvas canvas = new Canvas(mBitmap);
-
- final int width = bitmap.getWidth();
- final int height = bitmap.getHeight();
- final int square = Math.min(width, height);
-
- final Rect cropRect = new Rect((width - square) / 2, (height - square) / 2, square, square);
- final RectF circleRect = new RectF(0f, 0f, mSize, mSize);
- circleRect.inset(mStrokeWidth / 2f, mStrokeWidth / 2f);
- circleRect.inset(mShadowRadius, mShadowRadius);
-
- final Path fillPath = new Path();
- fillPath.addArc(circleRect, 0f, 360f);
-
- canvas.drawColor(0, PorterDuff.Mode.CLEAR);
-
- // opaque circle matte
- mPaint = new Paint();
- mPaint.setAntiAlias(true);
- mPaint.setColor(Color.BLACK);
- mPaint.setStyle(Paint.Style.FILL);
- canvas.drawPath(fillPath, mPaint);
-
- // mask in the icon where the bitmap is opaque
- mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP));
- canvas.drawBitmap(bitmap, cropRect, circleRect, mPaint);
-
- // prepare paint for frame drawing
- mPaint.setXfermode(null);
-
- mScale = 1f;
-
- mSrcRect = new Rect(0, 0, mSize, mSize);
- mDstRect = new RectF(0, 0, mSize, mSize);
- mFrameRect = new RectF(mDstRect);
- mFramePath = new Path();
- }
-
- public void reset() {
- mScale = 1f;
- mPressed = false;
- }
-
- @Override
- public void draw(Canvas canvas) {
- // clear background
- final float outside = Math.min(canvas.getWidth(), canvas.getHeight());
- final float inside = mScale * outside;
- final float pad = (outside - inside) / 2f;
-
- mDstRect.set(pad, pad, outside - pad, outside - pad);
- canvas.drawBitmap(mBitmap, mSrcRect, mDstRect, null);
-
- mFrameRect.set(mDstRect);
- mFrameRect.inset(mStrokeWidth / 2f, mStrokeWidth / 2f);
- mFrameRect.inset(mShadowRadius, mShadowRadius);
-
- mFramePath.reset();
- mFramePath.addArc(mFrameRect, 0f, 360f);
-
- // white frame
- if (mPressed) {
- mPaint.setStyle(Paint.Style.FILL);
- mPaint.setColor(Color.argb((int) (0.33f * 255),
- Color.red(mHighlightColor),
- Color.green(mHighlightColor),
- Color.blue(mHighlightColor)));
- canvas.drawPath(mFramePath, mPaint);
- }
- mPaint.setStrokeWidth(mStrokeWidth);
- mPaint.setStyle(Paint.Style.STROKE);
- mPaint.setColor(mPressed ? mHighlightColor : mFrameColor);
- mPaint.setShadowLayer(mShadowRadius, 0f, 0f, mFrameShadowColor);
- canvas.drawPath(mFramePath, mPaint);
- }
-
- public void setScale(float scale) {
- mScale = scale;
- }
-
- public float getScale() {
- return mScale;
- }
-
- public void setPressed(boolean pressed) {
- mPressed = pressed;
- }
-
- @Override
- public int getOpacity() {
- return PixelFormat.TRANSLUCENT;
- }
-
- @Override
- public void setAlpha(int alpha) {
- }
-
- @Override
- public void setColorFilter(ColorFilter cf) {
- }
-
- public boolean verifyParams(float iconSize, int frameColor, float stroke,
- int frameShadowColor, float shadowRadius, int highlightColor) {
- return mSize == iconSize
- && mFrameColor == frameColor
- && mStrokeWidth == stroke
- && mFrameShadowColor == frameShadowColor
- && mShadowRadius == shadowRadius
- && mHighlightColor == highlightColor;
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardFaceUnlockView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardFaceUnlockView.java
deleted file mode 100644
index b3e9f77..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardFaceUnlockView.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.keyguard;
-
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.telephony.TelephonyManager;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.IRotationWatcher;
-import android.view.IWindowManager;
-import android.view.View;
-import android.widget.ImageButton;
-import android.widget.LinearLayout;
-
-import com.android.internal.widget.LockPatternUtils;
-
-import java.lang.Math;
-
-public class KeyguardFaceUnlockView extends LinearLayout implements KeyguardSecurityView {
-
- private static final String TAG = "FULKeyguardFaceUnlockView";
- private static final boolean DEBUG = KeyguardConstants.DEBUG;
- private KeyguardSecurityCallback mKeyguardSecurityCallback;
- private LockPatternUtils mLockPatternUtils;
- private BiometricSensorUnlock mBiometricUnlock;
- private View mFaceUnlockAreaView;
- private ImageButton mCancelButton;
- private SecurityMessageDisplay mSecurityMessageDisplay;
- private View mEcaView;
- private Drawable mBouncerFrame;
-
- private boolean mIsBouncerVisibleToUser = false;
- private final Object mIsBouncerVisibleToUserLock = new Object();
-
- private int mLastRotation;
- private boolean mWatchingRotation;
- private final IWindowManager mWindowManager =
- IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
-
- private final IRotationWatcher mRotationWatcher = new IRotationWatcher.Stub() {
- public void onRotationChanged(int rotation) {
- if (DEBUG) Log.d(TAG, "onRotationChanged(): " + mLastRotation + "->" + rotation);
-
- // If the difference between the new rotation value and the previous rotation value is
- // equal to 2, the rotation change was 180 degrees. This stops the biometric unlock
- // and starts it in the new position. This is not performed for 90 degree rotations
- // since a 90 degree rotation is a configuration change, which takes care of this for
- // us.
- if (Math.abs(rotation - mLastRotation) == 2) {
- if (mBiometricUnlock != null) {
- mBiometricUnlock.stop();
- maybeStartBiometricUnlock();
- }
- }
- mLastRotation = rotation;
- }
- };
-
- public KeyguardFaceUnlockView(Context context) {
- this(context, null);
- }
-
- public KeyguardFaceUnlockView(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
-
- initializeBiometricUnlockView();
-
- mSecurityMessageDisplay = new KeyguardMessageArea.Helper(this);
- mEcaView = findViewById(R.id.keyguard_selector_fade_container);
- View bouncerFrameView = findViewById(R.id.keyguard_bouncer_frame);
- if (bouncerFrameView != null) {
- mBouncerFrame = bouncerFrameView.getBackground();
- }
- }
-
- @Override
- public void setKeyguardCallback(KeyguardSecurityCallback callback) {
- mKeyguardSecurityCallback = callback;
- // TODO: formalize this in the interface or factor it out
- ((FaceUnlock)mBiometricUnlock).setKeyguardCallback(callback);
- }
-
- @Override
- public void setLockPatternUtils(LockPatternUtils utils) {
- mLockPatternUtils = utils;
- }
-
- @Override
- public void reset() {
-
- }
-
- @Override
- public void onDetachedFromWindow() {
- if (DEBUG) Log.d(TAG, "onDetachedFromWindow()");
- if (mBiometricUnlock != null) {
- mBiometricUnlock.stop();
- }
- KeyguardUpdateMonitor.getInstance(mContext).removeCallback(mUpdateCallback);
- if (mWatchingRotation) {
- try {
- mWindowManager.removeRotationWatcher(mRotationWatcher);
- mWatchingRotation = false;
- } catch (RemoteException e) {
- Log.e(TAG, "Remote exception when removing rotation watcher");
- }
- }
- }
-
- @Override
- public void onPause() {
- if (DEBUG) Log.d(TAG, "onPause()");
- if (mBiometricUnlock != null) {
- mBiometricUnlock.stop();
- }
- KeyguardUpdateMonitor.getInstance(mContext).removeCallback(mUpdateCallback);
- if (mWatchingRotation) {
- try {
- mWindowManager.removeRotationWatcher(mRotationWatcher);
- mWatchingRotation = false;
- } catch (RemoteException e) {
- Log.e(TAG, "Remote exception when removing rotation watcher");
- }
- }
- }
-
- @Override
- public void onResume(int reason) {
- if (DEBUG) Log.d(TAG, "onResume()");
- synchronized (mIsBouncerVisibleToUserLock) {
- mIsBouncerVisibleToUser = isBouncerVisibleToUser();
- }
- KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateCallback);
-
- // Registers a callback which handles stopping the biometric unlock and restarting it in
- // the new position for a 180 degree rotation change.
- if (!mWatchingRotation) {
- try {
- mLastRotation = mWindowManager.watchRotation(mRotationWatcher);
- mWatchingRotation = true;
- } catch (RemoteException e) {
- Log.e(TAG, "Remote exception when adding rotation watcher");
- }
- }
- }
-
- @Override
- public boolean needsInput() {
- return false;
- }
-
- @Override
- public KeyguardSecurityCallback getCallback() {
- return mKeyguardSecurityCallback;
- }
-
- @Override
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
- super.onLayout(changed, l, t, r, b);
- mBiometricUnlock.initializeView(mFaceUnlockAreaView);
- }
-
- private void initializeBiometricUnlockView() {
- if (DEBUG) Log.d(TAG, "initializeBiometricUnlockView()");
- mFaceUnlockAreaView = findViewById(R.id.face_unlock_area_view);
- if (mFaceUnlockAreaView != null) {
- mBiometricUnlock = new FaceUnlock(mContext);
-
- mCancelButton = (ImageButton) findViewById(R.id.face_unlock_cancel_button);
- mCancelButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- mBiometricUnlock.stopAndShowBackup();
- }
- });
- } else {
- Log.w(TAG, "Couldn't find biometric unlock view");
- }
- }
-
- /**
- * Starts the biometric unlock if it should be started based on a number of factors. If it
- * should not be started, it either goes to the back up, or remains showing to prepare for
- * it being started later.
- */
- private void maybeStartBiometricUnlock() {
- if (DEBUG) Log.d(TAG, "maybeStartBiometricUnlock()");
- if (mBiometricUnlock != null) {
- KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
- final boolean backupIsTimedOut = (
- monitor.getFailedUnlockAttempts() >=
- LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT);
-
- boolean isBouncerVisibleToUser;
- synchronized(mIsBouncerVisibleToUserLock) {
- isBouncerVisibleToUser = mIsBouncerVisibleToUser;
- }
-
- // Don't start it if the bouncer is not showing, but keep this view up because we want
- // it here and ready for when the bouncer does show.
- if (!isBouncerVisibleToUser) {
- mBiometricUnlock.stop(); // It shouldn't be running but calling this can't hurt.
- return;
- }
-
- // Although these same conditions are handled in KeyguardSecurityModel, they are still
- // necessary here. When a tablet is rotated 90 degrees, a configuration change is
- // triggered and everything is torn down and reconstructed. That means
- // KeyguardSecurityModel gets a chance to take care of the logic and doesn't even
- // reconstruct KeyguardFaceUnlockView if the biometric unlock should be suppressed.
- // However, for a 180 degree rotation, no configuration change is triggered, so only
- // the logic here is capable of suppressing Face Unlock.
- if (monitor.getPhoneState() == TelephonyManager.CALL_STATE_IDLE
- && monitor.isAlternateUnlockEnabled()
- && !monitor.getMaxBiometricUnlockAttemptsReached()
- && !backupIsTimedOut) {
- mBiometricUnlock.start();
- } else {
- mBiometricUnlock.stopAndShowBackup();
- }
- }
- }
-
- // Returns true if the device is currently in a state where the user is seeing the bouncer.
- // This requires isKeyguardBouncer() to be true, but that doesn't imply that the screen is on or
- // the keyguard visibility is set to true, so we must check those conditions as well.
- private boolean isBouncerVisibleToUser() {
- KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
- return updateMonitor.isKeyguardBouncer() && updateMonitor.isKeyguardVisible() &&
- updateMonitor.isScreenOn();
- }
-
- // Starts the biometric unlock if the bouncer was not previously visible to the user, but is now
- // visibile to the user. Stops the biometric unlock if the bouncer was previously visible to
- // the user, but is no longer visible to the user.
- private void handleBouncerUserVisibilityChanged() {
- boolean wasBouncerVisibleToUser;
- synchronized(mIsBouncerVisibleToUserLock) {
- wasBouncerVisibleToUser = mIsBouncerVisibleToUser;
- mIsBouncerVisibleToUser = isBouncerVisibleToUser();
- }
-
- if (mBiometricUnlock != null) {
- if (wasBouncerVisibleToUser && !mIsBouncerVisibleToUser) {
- mBiometricUnlock.stop();
- } else if (!wasBouncerVisibleToUser && mIsBouncerVisibleToUser) {
- maybeStartBiometricUnlock();
- }
- }
- }
-
- KeyguardUpdateMonitorCallback mUpdateCallback = new KeyguardUpdateMonitorCallback() {
- // We need to stop the biometric unlock when a phone call comes in
- @Override
- public void onPhoneStateChanged(int phoneState) {
- if (DEBUG) Log.d(TAG, "onPhoneStateChanged(" + phoneState + ")");
- if (phoneState == TelephonyManager.CALL_STATE_RINGING) {
- if (mBiometricUnlock != null) {
- mBiometricUnlock.stopAndShowBackup();
- }
- }
- }
-
- @Override
- public void onUserSwitching(int userId) {
- if (DEBUG) Log.d(TAG, "onUserSwitched(" + userId + ")");
- if (mBiometricUnlock != null) {
- mBiometricUnlock.stop();
- }
- // No longer required; static value set by KeyguardViewMediator
- // mLockPatternUtils.setCurrentUser(userId);
- }
-
- @Override
- public void onUserSwitchComplete(int userId) {
- if (DEBUG) Log.d(TAG, "onUserSwitchComplete(" + userId + ")");
- if (mBiometricUnlock != null) {
- maybeStartBiometricUnlock();
- }
- }
-
- @Override
- public void onKeyguardVisibilityChanged(boolean showing) {
- if (DEBUG) Log.d(TAG, "onKeyguardVisibilityChanged(" + showing + ")");
- handleBouncerUserVisibilityChanged();
- }
-
- @Override
- public void onKeyguardBouncerChanged(boolean bouncer) {
- if (DEBUG) Log.d(TAG, "onKeyguardBouncerChanged(" + bouncer + ")");
- handleBouncerUserVisibilityChanged();
- }
-
- @Override
- public void onScreenTurnedOn() {
- if (DEBUG) Log.d(TAG, "onScreenTurnedOn()");
- handleBouncerUserVisibilityChanged();
- }
-
- @Override
- public void onScreenTurnedOff(int why) {
- if (DEBUG) Log.d(TAG, "onScreenTurnedOff()");
- handleBouncerUserVisibilityChanged();
- }
-
- @Override
- public void onEmergencyCallAction() {
- if (mBiometricUnlock != null) {
- mBiometricUnlock.stop();
- }
- }
- };
-
- @Override
- public void showUsabilityHint() {
- }
-
- @Override
- public void showBouncer(int duration) {
- KeyguardSecurityViewHelper.
- showBouncer(mSecurityMessageDisplay, mEcaView, mBouncerFrame, duration);
- }
-
- @Override
- public void hideBouncer(int duration) {
- KeyguardSecurityViewHelper.
- hideBouncer(mSecurityMessageDisplay, mEcaView, mBouncerFrame, duration);
- }
-
- @Override
- public void startAppearAnimation() {
- // TODO.
- }
-
- @Override
- public boolean startDisappearAnimation(Runnable finishRunnable) {
- return false;
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardGlowStripView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardGlowStripView.java
deleted file mode 100644
index 98a44a6..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardGlowStripView.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.keyguard;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ValueAnimator;
-import android.animation.ValueAnimator.AnimatorUpdateListener;
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.drawable.Drawable;
-import android.util.AttributeSet;
-import android.view.animation.DecelerateInterpolator;
-import android.view.animation.Interpolator;
-import android.view.animation.LinearInterpolator;
-import android.widget.LinearLayout;
-
-/**
- * A layout which animates a strip of horizontal, pulsing dots on request. This is used
- * to indicate the presence of pages to the left / right.
- */
-public class KeyguardGlowStripView extends LinearLayout {
- private static final int DURATION = 500;
-
- private static final float SLIDING_WINDOW_SIZE = 0.4f;
- private int mDotStripTop;
- private int mHorizontalDotGap;
-
- private int mDotSize;
- private int mNumDots;
- private Drawable mDotDrawable;
- private boolean mLeftToRight = true;
-
- private float mAnimationProgress = 0f;
- private boolean mDrawDots = false;
- private ValueAnimator mAnimator;
- private Interpolator mDotAlphaInterpolator = new DecelerateInterpolator(0.5f);
-
- public KeyguardGlowStripView(Context context) {
- this(context, null, 0);
- }
-
- public KeyguardGlowStripView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public KeyguardGlowStripView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
-
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.KeyguardGlowStripView);
- mDotSize = a.getDimensionPixelSize(R.styleable.KeyguardGlowStripView_dotSize, mDotSize);
- mNumDots = a.getInt(R.styleable.KeyguardGlowStripView_numDots, mNumDots);
- mDotDrawable = a.getDrawable(R.styleable.KeyguardGlowStripView_glowDot);
- mLeftToRight = a.getBoolean(R.styleable.KeyguardGlowStripView_leftToRight, mLeftToRight);
- }
-
- protected void onSizeChanged(int w, int h, int oldw, int oldh) {
- int availableWidth = w - getPaddingLeft() - getPaddingRight();
- mHorizontalDotGap = (availableWidth - mDotSize * mNumDots) / (mNumDots - 1);
- mDotStripTop = getPaddingTop();
- invalidate();
- }
-
- @Override
- protected void dispatchDraw(Canvas canvas) {
- super.dispatchDraw(canvas);
-
- if (!mDrawDots) return;
-
- int xOffset = getPaddingLeft();
- mDotDrawable.setBounds(0, 0, mDotSize, mDotSize);
-
- for (int i = 0; i < mNumDots; i++) {
- // We fudge the relative position to provide a fade in of the first dot and a fade
- // out of the final dot.
- float relativeDotPosition = SLIDING_WINDOW_SIZE / 2 + ((1.0f * i) / (mNumDots - 1)) *
- (1 - SLIDING_WINDOW_SIZE);
- float distance = Math.abs(relativeDotPosition - mAnimationProgress);
- float alpha = Math.max(0, 1 - distance / (SLIDING_WINDOW_SIZE / 2));
-
- alpha = mDotAlphaInterpolator.getInterpolation(alpha);
-
- canvas.save();
- canvas.translate(xOffset, mDotStripTop);
- mDotDrawable.setAlpha((int) (alpha * 255));
- mDotDrawable.draw(canvas);
- canvas.restore();
- xOffset += mDotSize + mHorizontalDotGap;
- }
- }
-
- public void makeEmGo() {
- if (mAnimator != null) {
- mAnimator.cancel();
- }
- float from = mLeftToRight ? 0f : 1f;
- float to = mLeftToRight ? 1f : 0f;
- mAnimator = ValueAnimator.ofFloat(from, to);
- mAnimator.setDuration(DURATION);
- mAnimator.setInterpolator(new LinearInterpolator());
- mAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mDrawDots = false;
- // make sure we draw one frame at the end with everything gone.
- invalidate();
- }
-
- @Override
- public void onAnimationStart(Animator animation) {
- mDrawDots = true;
- }
- });
- mAnimator.addUpdateListener(new AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
- mAnimationProgress = (Float) animation.getAnimatedValue();
- invalidate();
- }
- });
- mAnimator.start();
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
index ab18271..7fa5055 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,101 +16,37 @@
package com.android.keyguard;
-import com.android.internal.widget.LockPatternUtils;
-import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
-import com.android.keyguard.KeyguardUpdateMonitor.DisplayClientState;
-
+import android.app.Activity;
import android.app.ActivityManager;
-import android.app.ActivityOptions;
-import android.app.admin.DevicePolicyManager;
-import android.appwidget.AppWidgetHost;
-import android.appwidget.AppWidgetHostView;
-import android.appwidget.AppWidgetManager;
-import android.appwidget.AppWidgetProviderInfo;
-import android.content.ComponentName;
import android.content.Context;
-import android.content.Intent;
-import android.content.IntentSender;
-import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
-import android.graphics.Rect;
-import android.media.RemoteControlClient;
+import android.graphics.Canvas;
+import android.media.AudioManager;
import android.os.Bundle;
-import android.os.Looper;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.os.UserHandle;
-import android.os.UserManager;
-import android.provider.Settings;
+import android.os.SystemClock;
+import android.telephony.TelephonyManager;
import android.util.AttributeSet;
import android.util.Log;
-import android.util.Slog;
-import android.view.LayoutInflater;
+import android.view.KeyEvent;
import android.view.MotionEvent;
-import android.view.View;
-import android.widget.RemoteViews.OnClickHandler;
+import android.widget.FrameLayout;
-import java.lang.ref.WeakReference;
+import com.android.internal.widget.LockPatternUtils;
+import com.android.keyguard.KeyguardSecurityContainer.SecurityCallback;
+import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
-public class KeyguardHostView extends KeyguardViewBase {
- private static final String TAG = "KeyguardHostView";
- public static boolean DEBUG = KeyguardConstants.DEBUG;
- public static boolean DEBUGXPORT = true; // debug music transport control
+import java.io.File;
- // Transport control states.
- static final int TRANSPORT_GONE = 0;
- static final int TRANSPORT_INVISIBLE = 1;
- static final int TRANSPORT_VISIBLE = 2;
-
- private int mTransportState = TRANSPORT_GONE;
-
- // Found in KeyguardAppWidgetPickActivity.java
- static final int APPWIDGET_HOST_ID = 0x4B455947;
- private final int MAX_WIDGETS = 5;
-
- private AppWidgetHost mAppWidgetHost;
- private AppWidgetManager mAppWidgetManager;
- private KeyguardWidgetPager mAppWidgetContainer;
- // TODO remove transport control references, these don't exist anymore
- private KeyguardTransportControlView mTransportControl;
- private int mAppWidgetToShow;
-
- protected int mFailedAttempts;
-
- private KeyguardViewStateManager mViewStateManager;
-
- private Rect mTempRect = new Rect();
- private int mDisabledFeatures;
- private boolean mCameraDisabled;
- private boolean mSafeModeEnabled;
- private boolean mUserSetupCompleted;
-
- // User for whom this host view was created. Final because we should never change the
- // id without reconstructing an instance of KeyguardHostView. See note below...
- private final int mUserId;
-
- private KeyguardMultiUserSelectorView mKeyguardMultiUserSelectorView;
-
- protected int mClientGeneration;
-
- protected boolean mShowSecurityWhenReturn;
-
- private final Rect mInsets = new Rect();
-
- private MyOnClickHandler mOnClickHandler = new MyOnClickHandler(this);
-
- private Runnable mPostBootCompletedRunnable;
-
- /*package*/ interface UserSwitcherCallback {
- void hideSecurityView(int duration);
- void showSecurityView();
- void showUnlockHint();
- void userActivity();
- }
-
- interface TransportControlCallback {
- void userActivity();
- }
+/**
+ * Base class for keyguard view. {@link #reset} is where you should
+ * reset the state of your view. Use the {@link KeyguardViewCallback} via
+ * {@link #getCallback()} to send information back (such as poking the wake lock,
+ * or finishing the keyguard).
+ *
+ * Handles intercepting of media keys that still work when the keyguard is
+ * showing.
+ */
+public class KeyguardHostView extends FrameLayout implements SecurityCallback {
public interface OnDismissAction {
/**
@@ -119,361 +55,143 @@
boolean onDismiss();
}
+ private AudioManager mAudioManager;
+ private TelephonyManager mTelephonyManager = null;
+ protected ViewMediatorCallback mViewMediatorCallback;
+ protected LockPatternUtils mLockPatternUtils;
+ private OnDismissAction mDismissAction;
+
+ private final KeyguardUpdateMonitorCallback mUpdateCallback =
+ new KeyguardUpdateMonitorCallback() {
+
+ @Override
+ public void onUserSwitchComplete(int userId) {
+ getSecurityContainer().showPrimarySecurityScreen(false /* turning off */);
+ }
+
+ @Override
+ public void onTrustInitiatedByUser(int userId) {
+ if (userId != mLockPatternUtils.getCurrentUser()) return;
+ if (!isAttachedToWindow()) return;
+
+ if (isVisibleToUser()) {
+ dismiss(false /* authenticated */);
+ } else {
+ mViewMediatorCallback.playTrustedSound();
+ }
+ }
+ };
+
+ // Whether the volume keys should be handled by keyguard. If true, then
+ // they will be handled here for specific media types such as music, otherwise
+ // the audio service will bring up the volume dialog.
+ private static final boolean KEYGUARD_MANAGES_VOLUME = false;
+ public static final boolean DEBUG = KeyguardConstants.DEBUG;
+ private static final String TAG = "KeyguardViewBase";
+
+ private KeyguardSecurityContainer mSecurityContainer;
+
public KeyguardHostView(Context context) {
this(context, null);
}
public KeyguardHostView(Context context, AttributeSet attrs) {
super(context, attrs);
-
- if (DEBUG) Log.e(TAG, "KeyguardHostView()");
-
- mLockPatternUtils = new LockPatternUtils(context);
-
- // Note: This depends on KeyguardHostView getting reconstructed every time the
- // user switches, since mUserId will be used for the entire session.
- // Once created, keyguard should *never* re-use this instance with another user.
- // In other words, mUserId should never change - hence it's marked final.
- mUserId = mLockPatternUtils.getCurrentUser();
-
- DevicePolicyManager dpm =
- (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
- if (dpm != null) {
- mDisabledFeatures = getDisabledFeatures(dpm);
- mCameraDisabled = dpm.getCameraDisabled(null);
- }
-
- mSafeModeEnabled = LockPatternUtils.isSafeModeEnabled();
-
- // These need to be created with the user context...
- Context userContext = null;
- try {
- final String packageName = "system";
- userContext = mContext.createPackageContextAsUser(packageName, 0,
- new UserHandle(mUserId));
-
- } catch (NameNotFoundException e) {
- e.printStackTrace();
- // This should never happen, but it's better to have no widgets than to crash.
- userContext = context;
- }
-
- mAppWidgetHost = new AppWidgetHost(userContext, APPWIDGET_HOST_ID, mOnClickHandler,
- Looper.myLooper());
-
- mAppWidgetManager = AppWidgetManager.getInstance(userContext);
-
- mViewStateManager = new KeyguardViewStateManager(this);
-
- mUserSetupCompleted = Settings.Secure.getIntForUser(mContext.getContentResolver(),
- Settings.Secure.USER_SETUP_COMPLETE, 0, UserHandle.USER_CURRENT) != 0;
-
- // Ensure we have the current state *before* we call showAppropriateWidgetPage()
- getInitialTransportState();
-
- if (mSafeModeEnabled) {
- Log.v(TAG, "Keyguard widgets disabled by safe mode");
- }
- if ((mDisabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_WIDGETS_ALL) != 0) {
- Log.v(TAG, "Keyguard widgets disabled by DPM");
- }
- if ((mDisabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0) {
- Log.v(TAG, "Keyguard secure camera disabled by DPM");
- }
+ KeyguardUpdateMonitor.getInstance(context).registerCallback(mUpdateCallback);
}
- private void getInitialTransportState() {
- DisplayClientState dcs = KeyguardUpdateMonitor.getInstance(mContext)
- .getCachedDisplayClientState();
- mTransportState = (dcs.clearing ? TRANSPORT_GONE :
- (isMusicPlaying(dcs.playbackState) ? TRANSPORT_VISIBLE : TRANSPORT_INVISIBLE));
-
- if (DEBUGXPORT) Log.v(TAG, "Initial transport state: "
- + mTransportState + ", pbstate=" + dcs.playbackState);
- }
-
- private void cleanupAppWidgetIds() {
- if (mSafeModeEnabled || widgetsDisabled()) return;
-
- // Clean up appWidgetIds that are bound to lockscreen, but not actually used
- // This is only to clean up after another bug: we used to not call
- // deleteAppWidgetId when a user manually deleted a widget in keyguard. This code
- // shouldn't have to run more than once per user. AppWidgetProviders rely on callbacks
- // that are triggered by deleteAppWidgetId, which is why we're doing this
- int[] appWidgetIdsInKeyguardSettings = mLockPatternUtils.getAppWidgets();
- int[] appWidgetIdsBoundToHost = mAppWidgetHost.getAppWidgetIds();
- for (int i = 0; i < appWidgetIdsBoundToHost.length; i++) {
- int appWidgetId = appWidgetIdsBoundToHost[i];
- if (!contains(appWidgetIdsInKeyguardSettings, appWidgetId)) {
- Log.d(TAG, "Found a appWidgetId that's not being used by keyguard, deleting id "
- + appWidgetId);
- mAppWidgetHost.deleteAppWidgetId(appWidgetId);
- }
- }
- }
-
- private static boolean contains(int[] array, int target) {
- for (int value : array) {
- if (value == target) {
- return true;
- }
- }
- return false;
- }
-
- private KeyguardUpdateMonitorCallback mUpdateMonitorCallbacks =
- new KeyguardUpdateMonitorCallback() {
- @Override
- public void onBootCompleted() {
- if (mPostBootCompletedRunnable != null) {
- mPostBootCompletedRunnable.run();
- mPostBootCompletedRunnable = null;
- }
- }
- @Override
- public void onUserSwitchComplete(int userId) {
- if (mKeyguardMultiUserSelectorView != null) {
- mKeyguardMultiUserSelectorView.finalizeActiveUserView(true);
- }
- }
- };
-
- private static final boolean isMusicPlaying(int playbackState) {
- // This should agree with the list in AudioService.isPlaystateActive()
- switch (playbackState) {
- case RemoteControlClient.PLAYSTATE_PLAYING:
- case RemoteControlClient.PLAYSTATE_BUFFERING:
- case RemoteControlClient.PLAYSTATE_FAST_FORWARDING:
- case RemoteControlClient.PLAYSTATE_REWINDING:
- case RemoteControlClient.PLAYSTATE_SKIPPING_BACKWARDS:
- case RemoteControlClient.PLAYSTATE_SKIPPING_FORWARDS:
- return true;
- default:
- return false;
- }
- }
-
- private SlidingChallengeLayout mSlidingChallengeLayout;
- private MultiPaneChallengeLayout mMultiPaneChallengeLayout;
-
@Override
- public boolean onTouchEvent(MotionEvent ev) {
- boolean result = super.onTouchEvent(ev);
- mTempRect.set(0, 0, 0, 0);
- offsetRectIntoDescendantCoords(getSecurityContainer(), mTempRect);
- ev.offsetLocation(mTempRect.left, mTempRect.top);
- result = getSecurityContainer().dispatchTouchEvent(ev) || result;
- ev.offsetLocation(-mTempRect.left, -mTempRect.top);
- return result;
+ protected void dispatchDraw(Canvas canvas) {
+ super.dispatchDraw(canvas);
+ if (mViewMediatorCallback != null) {
+ mViewMediatorCallback.keyguardDoneDrawing();
+ }
}
- private int getWidgetPosition(int id) {
- final KeyguardWidgetPager appWidgetContainer = mAppWidgetContainer;
- final int children = appWidgetContainer.getChildCount();
- for (int i = 0; i < children; i++) {
- final View content = appWidgetContainer.getWidgetPageAt(i).getContent();
- if (content != null && content.getId() == id) {
- return i;
- } else if (content == null) {
- // Attempt to track down bug #8886916
- Log.w(TAG, "*** Null content at " + "i=" + i + ",id=" + id + ",N=" + children);
- }
- }
- return -1;
+ /**
+ * Sets an action to run when keyguard finishes.
+ *
+ * @param action
+ */
+ public void setOnDismissAction(OnDismissAction action) {
+ mDismissAction = action;
}
@Override
protected void onFinishInflate() {
- super.onFinishInflate();
-
- // Grab instances of and make any necessary changes to the main layouts. Create
- // view state manager and wire up necessary listeners / callbacks.
- View deleteDropTarget = findViewById(R.id.keyguard_widget_pager_delete_target);
- mAppWidgetContainer = (KeyguardWidgetPager) findViewById(R.id.app_widget_container);
- mAppWidgetContainer.setVisibility(VISIBLE);
- mAppWidgetContainer.setCallbacks(mWidgetCallbacks);
- mAppWidgetContainer.setDeleteDropTarget(deleteDropTarget);
- mAppWidgetContainer.setMinScale(0.5f);
-
- mSlidingChallengeLayout = (SlidingChallengeLayout) findViewById(R.id.sliding_layout);
- if (mSlidingChallengeLayout != null) {
- mSlidingChallengeLayout.setOnChallengeScrolledListener(mViewStateManager);
- }
- mAppWidgetContainer.setViewStateManager(mViewStateManager);
- mAppWidgetContainer.setLockPatternUtils(mLockPatternUtils);
-
- mMultiPaneChallengeLayout =
- (MultiPaneChallengeLayout) findViewById(R.id.multi_pane_challenge);
- ChallengeLayout challenge = mSlidingChallengeLayout != null ? mSlidingChallengeLayout :
- mMultiPaneChallengeLayout;
- challenge.setOnBouncerStateChangedListener(mViewStateManager);
- mAppWidgetContainer.setBouncerAnimationDuration(challenge.getBouncerAnimationDuration());
- mViewStateManager.setPagedView(mAppWidgetContainer);
- mViewStateManager.setChallengeLayout(challenge);
-
- mViewStateManager.setSecurityViewContainer(getSecurityContainer());
-
- if (KeyguardUpdateMonitor.getInstance(mContext).hasBootCompleted()) {
- updateAndAddWidgets();
- } else {
- // We can't add widgets until after boot completes because AppWidgetHost may try
- // to contact the providers. Do it later.
- mPostBootCompletedRunnable = new Runnable() {
- @Override
- public void run() {
- updateAndAddWidgets();
- }
- };
- }
-
- getSecurityContainer().updateSecurityViews(mViewStateManager.isBouncing());
- enableUserSelectorIfNecessary();
+ mSecurityContainer =
+ (KeyguardSecurityContainer) findViewById(R.id.keyguard_security_container);
+ mLockPatternUtils = new LockPatternUtils(mContext);
+ mSecurityContainer.setLockPatternUtils(mLockPatternUtils);
+ mSecurityContainer.setSecurityCallback(this);
+ mSecurityContainer.showPrimarySecurityScreen(false);
+ // mSecurityContainer.updateSecurityViews(false /* not bouncing */);
}
- private void updateAndAddWidgets() {
- cleanupAppWidgetIds();
- addDefaultWidgets();
- addWidgetsFromSettings();
- maybeEnableAddButton();
- checkAppWidgetConsistency();
-
- // Don't let the user drag the challenge down if widgets are disabled.
- if (mSlidingChallengeLayout != null) {
- mSlidingChallengeLayout.setEnableChallengeDragging(!widgetsDisabled());
- }
-
- // Select the appropriate page
- mSwitchPageRunnable.run();
-
- // This needs to be called after the pages are all added.
- mViewStateManager.showUsabilityHints();
+ /**
+ * Called when the view needs to be shown.
+ */
+ public void showPrimarySecurityScreen() {
+ if (DEBUG) Log.d(TAG, "show()");
+ mSecurityContainer.showPrimarySecurityScreen(false);
}
- private void maybeEnableAddButton() {
- if (!shouldEnableAddWidget()) {
- mAppWidgetContainer.setAddWidgetEnabled(false);
- }
+ /**
+ * Dismisses the keyguard by going to the next screen or making it gone.
+ *
+ * @return True if the keyguard is done.
+ */
+ public boolean dismiss() {
+ return dismiss(false);
}
- private boolean shouldEnableAddWidget() {
- return numWidgets() < MAX_WIDGETS && mUserSetupCompleted;
+ public boolean handleBackKey() {
+ if (mSecurityContainer.getCurrentSecuritySelection() != SecurityMode.None) {
+ mSecurityContainer.dismiss(false);
+ return true;
+ }
+ return false;
+ }
+
+ protected KeyguardSecurityContainer getSecurityContainer() {
+ return mSecurityContainer;
}
@Override
public boolean dismiss(boolean authenticated) {
- boolean finished = super.dismiss(authenticated);
- if (!finished) {
- mViewStateManager.showBouncer(true);
+ return mSecurityContainer.showNextSecurityScreenOrFinish(authenticated);
+ }
- // Enter full screen mode if we're in SIM or Account screen
- SecurityMode securityMode = getSecurityContainer().getSecurityMode();
- boolean isFullScreen = getResources().getBoolean(R.bool.kg_sim_puk_account_full_screen);
- boolean isSimOrAccount = securityMode == SecurityMode.SimPin
- || securityMode == SecurityMode.SimPuk
- || securityMode == SecurityMode.Account;
- mAppWidgetContainer.setVisibility(
- isSimOrAccount && isFullScreen ? View.GONE : View.VISIBLE);
+ /**
+ * Authentication has happened and it's time to dismiss keyguard. This function
+ * should clean up and inform KeyguardViewMediator.
+ */
+ @Override
+ public void finish() {
+ // If the alternate unlock was suppressed, it can now be safely
+ // enabled because the user has left keyguard.
+ KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(true);
- // Don't show camera or search in navbar when SIM or Account screen is showing
- setSystemUiVisibility(isSimOrAccount ?
- (getSystemUiVisibility() | View.STATUS_BAR_DISABLE_SEARCH)
- : (getSystemUiVisibility() & ~View.STATUS_BAR_DISABLE_SEARCH));
-
- if (mSlidingChallengeLayout != null) {
- mSlidingChallengeLayout.setChallengeInteractive(!isFullScreen);
+ // If there's a pending runnable because the user interacted with a widget
+ // and we're leaving keyguard, then run it.
+ boolean deferKeyguardDone = false;
+ if (mDismissAction != null) {
+ deferKeyguardDone = mDismissAction.onDismiss();
+ mDismissAction = null;
+ }
+ if (mViewMediatorCallback != null) {
+ if (deferKeyguardDone) {
+ mViewMediatorCallback.keyguardDonePending();
+ } else {
+ mViewMediatorCallback.keyguardDone(true);
}
}
- return finished;
- }
-
- private int getDisabledFeatures(DevicePolicyManager dpm) {
- int disabledFeatures = DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_NONE;
- if (dpm != null) {
- final int currentUser = mLockPatternUtils.getCurrentUser();
- disabledFeatures = dpm.getKeyguardDisabledFeatures(null, currentUser);
- }
- return disabledFeatures;
- }
-
- private boolean widgetsDisabled() {
- boolean disabledByLowRamDevice = ActivityManager.isLowRamDeviceStatic();
- boolean disabledByDpm =
- (mDisabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_WIDGETS_ALL) != 0;
- boolean disabledByUser = !mLockPatternUtils.getWidgetsEnabled();
- return disabledByLowRamDevice || disabledByDpm || disabledByUser;
- }
-
- private boolean cameraDisabledByDpm() {
- return mCameraDisabled
- || (mDisabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0;
}
@Override
- public void setLockPatternUtils(LockPatternUtils utils) {
- super.setLockPatternUtils(utils);
- getSecurityContainer().updateSecurityViews(mViewStateManager.isBouncing());
- }
-
- @Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
- mAppWidgetHost.startListening();
- KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitorCallbacks);
- }
-
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- mAppWidgetHost.stopListening();
- KeyguardUpdateMonitor.getInstance(mContext).removeCallback(mUpdateMonitorCallbacks);
- }
-
- void addWidget(AppWidgetHostView view, int pageIndex) {
- mAppWidgetContainer.addWidget(view, pageIndex);
- }
-
- private KeyguardWidgetPager.Callbacks mWidgetCallbacks
- = new KeyguardWidgetPager.Callbacks() {
- @Override
- public void userActivity() {
- KeyguardHostView.this.userActivity();
- }
-
- @Override
- public void onUserActivityTimeoutChanged() {
- KeyguardHostView.this.onUserActivityTimeoutChanged();
- }
-
- @Override
- public void onAddView(View v) {
- if (!shouldEnableAddWidget()) {
- mAppWidgetContainer.setAddWidgetEnabled(false);
- }
- }
-
- @Override
- public void onRemoveView(View v, boolean deletePermanently) {
- if (deletePermanently) {
- final int appWidgetId = ((KeyguardWidgetFrame) v).getContentAppWidgetId();
- if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID &&
- appWidgetId != LockPatternUtils.ID_DEFAULT_STATUS_WIDGET) {
- mAppWidgetHost.deleteAppWidgetId(appWidgetId);
- }
- }
- }
-
- @Override
- public void onRemoveViewAnimationCompleted() {
- if (shouldEnableAddWidget()) {
- mAppWidgetContainer.setAddWidgetEnabled(true);
- }
- }
- };
-
- @Override
- public void onUserSwitching(boolean switching) {
- if (!switching && mKeyguardMultiUserSelectorView != null) {
- mKeyguardMultiUserSelectorView.finalizeActiveUserView(false);
+ public void onSecurityModeChanged(SecurityMode securityMode, boolean needsInput) {
+ if (mViewMediatorCallback != null) {
+ mViewMediatorCallback.setNeedsInput(needsInput);
}
}
@@ -483,631 +201,228 @@
}
}
- public void onUserActivityTimeoutChanged() {
- if (mViewMediatorCallback != null) {
- mViewMediatorCallback.onUserActivityTimeoutChanged();
+ /**
+ * Called when the Keyguard is not actively shown anymore on the screen.
+ */
+ public void onPause() {
+ if (DEBUG) Log.d(TAG, String.format("screen off, instance %s at %s",
+ Integer.toHexString(hashCode()), SystemClock.uptimeMillis()));
+ // Once the screen turns off, we no longer consider this to be first boot and we want the
+ // biometric unlock to start next time keyguard is shown.
+ KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(true);
+ mSecurityContainer.showPrimarySecurityScreen(true);
+ mSecurityContainer.onPause();
+ clearFocus();
+ }
+
+ /**
+ * Called when the Keyguard is actively shown on the screen.
+ */
+ public void onResume() {
+ if (DEBUG) Log.d(TAG, "screen on, instance " + Integer.toHexString(hashCode()));
+ mSecurityContainer.onResume(KeyguardSecurityView.SCREEN_ON);
+ requestFocus();
+ }
+
+ /**
+ * Starts the animation when the Keyguard gets shown.
+ */
+ public void startAppearAnimation() {
+ mSecurityContainer.startAppearAnimation();
+ }
+
+ public void startDisappearAnimation(Runnable finishRunnable) {
+ if (!mSecurityContainer.startDisappearAnimation(finishRunnable) && finishRunnable != null) {
+ finishRunnable.run();
}
}
+ /**
+ * Verify that the user can get past the keyguard securely. This is called,
+ * for example, when the phone disables the keyguard but then wants to launch
+ * something else that requires secure access.
+ *
+ * The result will be propogated back via {@link KeyguardViewCallback#keyguardDone(boolean)}
+ */
+ public void verifyUnlock() {
+ SecurityMode securityMode = mSecurityContainer.getSecurityMode();
+ if (securityMode == KeyguardSecurityModel.SecurityMode.None) {
+ if (mViewMediatorCallback != null) {
+ mViewMediatorCallback.keyguardDone(true);
+ }
+ } else if (securityMode != KeyguardSecurityModel.SecurityMode.Pattern
+ && securityMode != KeyguardSecurityModel.SecurityMode.PIN
+ && securityMode != KeyguardSecurityModel.SecurityMode.Password) {
+ // can only verify unlock when in pattern/password mode
+ if (mViewMediatorCallback != null) {
+ mViewMediatorCallback.keyguardDone(false);
+ }
+ } else {
+ // otherwise, go to the unlock screen, see if they can verify it
+ mSecurityContainer.verifyUnlock();
+ }
+ }
+
+ /**
+ * Called before this view is being removed.
+ */
+ public void cleanUp() {
+ getSecurityContainer().onPause();
+ }
+
@Override
- public long getUserActivityTimeout() {
- // Currently only considering user activity timeouts needed by widgets.
- // Could also take into account longer timeouts for certain security views.
- if (mAppWidgetContainer != null) {
- return mAppWidgetContainer.getUserActivityTimeout();
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ if (interceptMediaKey(event)) {
+ return true;
}
- return -1;
+ return super.dispatchKeyEvent(event);
}
- private static class MyOnClickHandler extends OnClickHandler {
+ /**
+ * Allows the media keys to work when the keyguard is showing.
+ * The media keys should be of no interest to the actual keyguard view(s),
+ * so intercepting them here should not be of any harm.
+ * @param event The key event
+ * @return whether the event was consumed as a media key.
+ */
+ public boolean interceptMediaKey(KeyEvent event) {
+ final int keyCode = event.getKeyCode();
+ if (event.getAction() == KeyEvent.ACTION_DOWN) {
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_MEDIA_PLAY:
+ case KeyEvent.KEYCODE_MEDIA_PAUSE:
+ case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
+ /* Suppress PLAY/PAUSE toggle when phone is ringing or
+ * in-call to avoid music playback */
+ if (mTelephonyManager == null) {
+ mTelephonyManager = (TelephonyManager) getContext().getSystemService(
+ Context.TELEPHONY_SERVICE);
+ }
+ if (mTelephonyManager != null &&
+ mTelephonyManager.getCallState() != TelephonyManager.CALL_STATE_IDLE) {
+ return true; // suppress key event
+ }
+ case KeyEvent.KEYCODE_MUTE:
+ case KeyEvent.KEYCODE_HEADSETHOOK:
+ case KeyEvent.KEYCODE_MEDIA_STOP:
+ case KeyEvent.KEYCODE_MEDIA_NEXT:
+ case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
+ case KeyEvent.KEYCODE_MEDIA_REWIND:
+ case KeyEvent.KEYCODE_MEDIA_RECORD:
+ case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
+ case KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK: {
+ handleMediaKeyEvent(event);
+ return true;
+ }
- // weak reference to the hostView to avoid keeping a live reference
- // due to Binder GC linkages to AppWidgetHost. By the same token,
- // this click handler should not keep references to any large
- // objects.
- WeakReference<KeyguardHostView> mKeyguardHostView;
-
- MyOnClickHandler(KeyguardHostView hostView) {
- mKeyguardHostView = new WeakReference<KeyguardHostView>(hostView);
- }
-
- @Override
- public boolean onClickHandler(final View view,
- final android.app.PendingIntent pendingIntent,
- final Intent fillInIntent) {
- KeyguardHostView hostView = mKeyguardHostView.get();
- if (hostView == null) {
- return false;
- }
- if (pendingIntent.isActivity()) {
- hostView.setOnDismissAction(new OnDismissAction() {
- public boolean onDismiss() {
- try {
- // TODO: Unregister this handler if PendingIntent.FLAG_ONE_SHOT?
- Context context = view.getContext();
- ActivityOptions opts = ActivityOptions.makeScaleUpAnimation(view,
- 0, 0,
- view.getMeasuredWidth(), view.getMeasuredHeight());
- context.startIntentSender(
- pendingIntent.getIntentSender(), fillInIntent,
- Intent.FLAG_ACTIVITY_NEW_TASK,
- Intent.FLAG_ACTIVITY_NEW_TASK, 0, opts.toBundle());
- } catch (IntentSender.SendIntentException e) {
- android.util.Log.e(TAG, "Cannot send pending intent: ", e);
- } catch (Exception e) {
- android.util.Log.e(TAG, "Cannot send pending intent due to " +
- "unknown exception: ", e);
+ case KeyEvent.KEYCODE_VOLUME_UP:
+ case KeyEvent.KEYCODE_VOLUME_DOWN:
+ case KeyEvent.KEYCODE_VOLUME_MUTE: {
+ if (KEYGUARD_MANAGES_VOLUME) {
+ synchronized (this) {
+ if (mAudioManager == null) {
+ mAudioManager = (AudioManager) getContext().getSystemService(
+ Context.AUDIO_SERVICE);
+ }
}
+ // Volume buttons should only function for music (local or remote).
+ // TODO: Actually handle MUTE.
+ mAudioManager.adjustSuggestedStreamVolume(
+ keyCode == KeyEvent.KEYCODE_VOLUME_UP
+ ? AudioManager.ADJUST_RAISE
+ : AudioManager.ADJUST_LOWER /* direction */,
+ AudioManager.STREAM_MUSIC /* stream */, 0 /* flags */);
+ // Don't execute default volume behavior
+ return true;
+ } else {
return false;
}
- });
-
- if (hostView.mViewStateManager.isChallengeShowing()) {
- hostView.mViewStateManager.showBouncer(true);
- } else {
- hostView.dismiss();
- }
- return true;
- } else {
- return super.onClickHandler(view, pendingIntent, fillInIntent);
- }
- };
- };
-
- @Override
- public void onResume() {
- super.onResume();
- if (mViewStateManager != null) {
- mViewStateManager.showUsabilityHints();
- }
- }
-
- @Override
- public void onPause() {
- super.onPause();
- // We use mAppWidgetToShow to show a particular widget after you add it-- once the screen
- // turns off we reset that behavior
- clearAppWidgetToShow();
- if (KeyguardUpdateMonitor.getInstance(mContext).hasBootCompleted()) {
- checkAppWidgetConsistency();
- }
- CameraWidgetFrame cameraPage = findCameraPage();
- if (cameraPage != null) {
- cameraPage.onScreenTurnedOff();
- }
- }
-
- public void clearAppWidgetToShow() {
- mAppWidgetToShow = AppWidgetManager.INVALID_APPWIDGET_ID;
- }
-
- private boolean addWidget(int appId, int pageIndex, boolean updateDbIfFailed) {
- AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(appId);
- if (appWidgetInfo != null) {
- AppWidgetHostView view = mAppWidgetHost.createView(mContext, appId, appWidgetInfo);
- addWidget(view, pageIndex);
- return true;
- } else {
- if (updateDbIfFailed) {
- Log.w(TAG, "*** AppWidgetInfo for app widget id " + appId + " was null for user"
- + mUserId + ", deleting");
- mAppWidgetHost.deleteAppWidgetId(appId);
- mLockPatternUtils.removeAppWidget(appId);
- }
- return false;
- }
- }
-
- private final CameraWidgetFrame.Callbacks mCameraWidgetCallbacks =
- new CameraWidgetFrame.Callbacks() {
- @Override
- public void onLaunchingCamera() {
- setSliderHandleAlpha(0);
- }
-
- @Override
- public void onCameraLaunchedSuccessfully() {
- if (mAppWidgetContainer.isCameraPage(mAppWidgetContainer.getCurrentPage())) {
- mAppWidgetContainer.scrollLeft();
- }
- setSliderHandleAlpha(1);
- mShowSecurityWhenReturn = true;
- }
-
- @Override
- public void onCameraLaunchedUnsuccessfully() {
- setSliderHandleAlpha(1);
- }
-
- private void setSliderHandleAlpha(float alpha) {
- SlidingChallengeLayout slider =
- (SlidingChallengeLayout) findViewById(R.id.sliding_layout);
- if (slider != null) {
- slider.setHandleAlpha(alpha);
}
}
- };
-
- private int numWidgets() {
- final int childCount = mAppWidgetContainer.getChildCount();
- int widgetCount = 0;
- for (int i = 0; i < childCount; i++) {
- if (mAppWidgetContainer.isWidgetPage(i)) {
- widgetCount++;
- }
- }
- return widgetCount;
- }
-
- private void addDefaultWidgets() {
- if (!mSafeModeEnabled && !widgetsDisabled()) {
- LayoutInflater inflater = LayoutInflater.from(mContext);
- View addWidget = inflater.inflate(R.layout.keyguard_add_widget, this, false);
- mAppWidgetContainer.addWidget(addWidget, 0);
- View addWidgetButton = addWidget.findViewById(R.id.keyguard_add_widget_view);
- addWidgetButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- // Pass in an invalid widget id... the picker will allocate an ID for us
- getActivityLauncher().launchWidgetPicker(AppWidgetManager.INVALID_APPWIDGET_ID);
- }
- });
- }
-
- // We currently disable cameras in safe mode because we support loading 3rd party
- // cameras we can't trust. TODO: plumb safe mode into camera creation code and only
- // inflate system-provided camera?
- if (!mSafeModeEnabled && !cameraDisabledByDpm() && mUserSetupCompleted
- && mContext.getResources().getBoolean(R.bool.kg_enable_camera_default_widget)) {
- View cameraWidget = CameraWidgetFrame.create(mContext, mCameraWidgetCallbacks,
- getActivityLauncher());
- if (cameraWidget != null) {
- mAppWidgetContainer.addWidget(cameraWidget);
- }
- }
- }
-
- /**
- * Create KeyguardTransportControlView on demand.
- * @return
- */
- private KeyguardTransportControlView getOrCreateTransportControl() {
- if (mTransportControl == null) {
- LayoutInflater inflater = LayoutInflater.from(mContext);
- mTransportControl = (KeyguardTransportControlView)
- inflater.inflate(R.layout.keyguard_transport_control_view, this, false);
- mTransportControl.setTransportControlCallback(new TransportControlCallback() {
- public void userActivity() {
- mViewMediatorCallback.userActivity();
- }
- });
- }
- return mTransportControl;
- }
-
- private int getInsertPageIndex() {
- View addWidget = mAppWidgetContainer.findViewById(R.id.keyguard_add_widget);
- int insertionIndex = mAppWidgetContainer.indexOfChild(addWidget);
- if (insertionIndex < 0) {
- insertionIndex = 0; // no add widget page found
- } else {
- insertionIndex++; // place after add widget
- }
- return insertionIndex;
- }
-
- private void addDefaultStatusWidget(int index) {
- LayoutInflater inflater = LayoutInflater.from(mContext);
- View statusWidget = inflater.inflate(R.layout.keyguard_status_view, null, true);
- mAppWidgetContainer.addWidget(statusWidget, index);
- }
-
- private void addWidgetsFromSettings() {
- if (mSafeModeEnabled || widgetsDisabled()) {
- addDefaultStatusWidget(0);
- return;
- }
-
- int insertionIndex = getInsertPageIndex();
-
- // Add user-selected widget
- final int[] widgets = mLockPatternUtils.getAppWidgets();
-
- if (widgets == null) {
- Log.d(TAG, "Problem reading widgets");
- } else {
- for (int i = widgets.length -1; i >= 0; i--) {
- if (widgets[i] == LockPatternUtils.ID_DEFAULT_STATUS_WIDGET) {
- addDefaultStatusWidget(insertionIndex);
- } else {
- // We add the widgets from left to right, starting after the first page after
- // the add page. We count down, since the order will be persisted from right
- // to left, starting after camera.
- addWidget(widgets[i], insertionIndex, true);
+ } else if (event.getAction() == KeyEvent.ACTION_UP) {
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_MUTE:
+ case KeyEvent.KEYCODE_HEADSETHOOK:
+ case KeyEvent.KEYCODE_MEDIA_PLAY:
+ case KeyEvent.KEYCODE_MEDIA_PAUSE:
+ case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
+ case KeyEvent.KEYCODE_MEDIA_STOP:
+ case KeyEvent.KEYCODE_MEDIA_NEXT:
+ case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
+ case KeyEvent.KEYCODE_MEDIA_REWIND:
+ case KeyEvent.KEYCODE_MEDIA_RECORD:
+ case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
+ case KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK: {
+ handleMediaKeyEvent(event);
+ return true;
}
}
}
- }
-
- private int allocateIdForDefaultAppWidget() {
- int appWidgetId;
- Resources res = getContext().getResources();
- ComponentName defaultAppWidget = new ComponentName(
- res.getString(R.string.widget_default_package_name),
- res.getString(R.string.widget_default_class_name));
-
- // Note: we don't support configuring the widget
- appWidgetId = mAppWidgetHost.allocateAppWidgetId();
-
- try {
- mAppWidgetManager.bindAppWidgetId(appWidgetId, defaultAppWidget);
- } catch (IllegalArgumentException e) {
- Log.e(TAG, "Error when trying to bind default AppWidget: " + e);
- mAppWidgetHost.deleteAppWidgetId(appWidgetId);
- appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
- }
- return appWidgetId;
- }
-
- public void checkAppWidgetConsistency() {
- final int childCount = mAppWidgetContainer.getChildCount();
- boolean widgetPageExists = false;
- for (int i = 0; i < childCount; i++) {
- if (mAppWidgetContainer.isWidgetPage(i)) {
- widgetPageExists = true;
- break;
- }
- }
- if (!widgetPageExists) {
- final int insertPageIndex = getInsertPageIndex();
-
- final boolean userAddedWidgetsEnabled = !widgetsDisabled();
-
- boolean addedDefaultAppWidget = false;
-
- if (!mSafeModeEnabled) {
- if (userAddedWidgetsEnabled) {
- int appWidgetId = allocateIdForDefaultAppWidget();
- if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
- addedDefaultAppWidget = addWidget(appWidgetId, insertPageIndex, true);
- }
- } else {
- // note: even if widgetsDisabledByDpm() returns true, we still bind/create
- // the default appwidget if possible
- int appWidgetId = mLockPatternUtils.getFallbackAppWidgetId();
- if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
- appWidgetId = allocateIdForDefaultAppWidget();
- if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
- mLockPatternUtils.writeFallbackAppWidgetId(appWidgetId);
- }
- }
- if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
- addedDefaultAppWidget = addWidget(appWidgetId, insertPageIndex, false);
- if (!addedDefaultAppWidget) {
- mAppWidgetHost.deleteAppWidgetId(appWidgetId);
- mLockPatternUtils.writeFallbackAppWidgetId(
- AppWidgetManager.INVALID_APPWIDGET_ID);
- }
- }
- }
- }
-
- // Use the built-in status/clock view if we can't inflate the default widget
- if (!addedDefaultAppWidget) {
- addDefaultStatusWidget(insertPageIndex);
- }
-
- // trigger DB updates only if user-added widgets are enabled
- if (!mSafeModeEnabled && userAddedWidgetsEnabled) {
- mAppWidgetContainer.onAddView(
- mAppWidgetContainer.getChildAt(insertPageIndex), insertPageIndex);
- }
- }
- }
-
- private final Runnable mSwitchPageRunnable = new Runnable() {
- @Override
- public void run() {
- showAppropriateWidgetPage();
- }
- };
-
- static class SavedState extends BaseSavedState {
- int transportState;
- int appWidgetToShow = AppWidgetManager.INVALID_APPWIDGET_ID;
- Rect insets = new Rect();
-
- SavedState(Parcelable superState) {
- super(superState);
- }
-
- private SavedState(Parcel in) {
- super(in);
- this.transportState = in.readInt();
- this.appWidgetToShow = in.readInt();
- this.insets = in.readParcelable(null);
- }
-
- @Override
- public void writeToParcel(Parcel out, int flags) {
- super.writeToParcel(out, flags);
- out.writeInt(this.transportState);
- out.writeInt(this.appWidgetToShow);
- out.writeParcelable(insets, 0);
- }
-
- public static final Parcelable.Creator<SavedState> CREATOR
- = new Parcelable.Creator<SavedState>() {
- public SavedState createFromParcel(Parcel in) {
- return new SavedState(in);
- }
-
- public SavedState[] newArray(int size) {
- return new SavedState[size];
- }
- };
- }
-
- @Override
- public Parcelable onSaveInstanceState() {
- if (DEBUG) Log.d(TAG, "onSaveInstanceState, tstate=" + mTransportState);
- Parcelable superState = super.onSaveInstanceState();
- SavedState ss = new SavedState(superState);
- // If the transport is showing, force it to show it on restore.
- final boolean showing = mTransportControl != null
- && mAppWidgetContainer.getWidgetPageIndex(mTransportControl) >= 0;
- ss.transportState = showing ? TRANSPORT_VISIBLE : mTransportState;
- ss.appWidgetToShow = mAppWidgetToShow;
- ss.insets.set(mInsets);
- return ss;
- }
-
- @Override
- public void onRestoreInstanceState(Parcelable state) {
- if (!(state instanceof SavedState)) {
- super.onRestoreInstanceState(state);
- return;
- }
- SavedState ss = (SavedState) state;
- super.onRestoreInstanceState(ss.getSuperState());
- mTransportState = (ss.transportState);
- mAppWidgetToShow = ss.appWidgetToShow;
- setInsets(ss.insets);
- if (DEBUG) Log.d(TAG, "onRestoreInstanceState, transport=" + mTransportState);
- mSwitchPageRunnable.run();
- }
-
- @Override
- protected boolean fitSystemWindows(Rect insets) {
- setInsets(insets);
- return true;
- }
-
- private void setInsets(Rect insets) {
- mInsets.set(insets);
- if (mSlidingChallengeLayout != null) mSlidingChallengeLayout.setInsets(mInsets);
- if (mMultiPaneChallengeLayout != null) mMultiPaneChallengeLayout.setInsets(mInsets);
-
- final CameraWidgetFrame cameraWidget = findCameraPage();
- if (cameraWidget != null) cameraWidget.setInsets(mInsets);
- }
-
- @Override
- public void onWindowFocusChanged(boolean hasWindowFocus) {
- super.onWindowFocusChanged(hasWindowFocus);
- if (DEBUG) Log.d(TAG, "Window is " + (hasWindowFocus ? "focused" : "unfocused"));
- if (hasWindowFocus && mShowSecurityWhenReturn) {
- SlidingChallengeLayout slider =
- (SlidingChallengeLayout) findViewById(R.id.sliding_layout);
- if (slider != null) {
- slider.setHandleAlpha(1);
- slider.showChallenge(true);
- }
- mShowSecurityWhenReturn = false;
- }
- }
-
- private void showAppropriateWidgetPage() {
- final int state = mTransportState;
- final boolean transportAdded = ensureTransportPresentOrRemoved(state);
- final int pageToShow = getAppropriateWidgetPage(state);
- if (!transportAdded) {
- mAppWidgetContainer.setCurrentPage(pageToShow);
- } else if (state == TRANSPORT_VISIBLE) {
- // If the transport was just added, we need to wait for layout to happen before
- // we can set the current page.
- post(new Runnable() {
- @Override
- public void run() {
- mAppWidgetContainer.setCurrentPage(pageToShow);
- }
- });
- }
- }
-
- /**
- * Examines the current state and adds the transport to the widget pager when the state changes.
- *
- * Showing the initial transport and keeping it around is a bit tricky because the signals
- * coming from music players aren't always clear. Here's how the states are handled:
- *
- * {@link TRANSPORT_GONE} means we have no reason to show the transport - remove it if present.
- *
- * {@link TRANSPORT_INVISIBLE} means we have potential to show the transport because a music
- * player is registered but not currently playing music (or we don't know the state yet). The
- * code adds it conditionally on play state.
- *
- * {@link #TRANSPORT_VISIBLE} means a music player is active and transport should be showing.
- *
- * Once the transport is showing, we always show it until keyguard is dismissed. This state is
- * maintained by onSave/RestoreInstanceState(). This state is cleared in
- * {@link KeyguardViewManager#hide} when keyguard is dismissed, which causes the transport to be
- * gone when keyguard is restarted until we get an update with the current state.
- *
- * @param state
- */
- private boolean ensureTransportPresentOrRemoved(int state) {
- final boolean showing = getWidgetPosition(R.id.keyguard_transport_control) != -1;
- final boolean visible = state == TRANSPORT_VISIBLE;
- final boolean shouldBeVisible = state == TRANSPORT_INVISIBLE && isMusicPlaying(state);
- if (!showing && (visible || shouldBeVisible)) {
- // insert to left of camera if it exists, otherwise after right-most widget
- int lastWidget = mAppWidgetContainer.getChildCount() - 1;
- int position = 0; // handle no widget case
- if (lastWidget >= 0) {
- position = mAppWidgetContainer.isCameraPage(lastWidget) ?
- lastWidget : lastWidget + 1;
- }
- if (DEBUGXPORT) Log.v(TAG, "add transport at " + position);
- mAppWidgetContainer.addWidget(getOrCreateTransportControl(), position);
- return true;
- } else if (showing && state == TRANSPORT_GONE) {
- if (DEBUGXPORT) Log.v(TAG, "remove transport");
- mAppWidgetContainer.removeWidget(getOrCreateTransportControl());
- mTransportControl = null;
- KeyguardUpdateMonitor.getInstance(getContext()).dispatchSetBackground(null);
- }
return false;
}
- private CameraWidgetFrame findCameraPage() {
- for (int i = mAppWidgetContainer.getChildCount() - 1; i >= 0; i--) {
- if (mAppWidgetContainer.isCameraPage(i)) {
- return (CameraWidgetFrame) mAppWidgetContainer.getChildAt(i);
+ private void handleMediaKeyEvent(KeyEvent keyEvent) {
+ synchronized (this) {
+ if (mAudioManager == null) {
+ mAudioManager = (AudioManager) getContext().getSystemService(
+ Context.AUDIO_SERVICE);
}
}
- return null;
- }
-
- boolean isMusicPage(int pageIndex) {
- return pageIndex >= 0 && pageIndex == getWidgetPosition(R.id.keyguard_transport_control);
- }
-
- private int getAppropriateWidgetPage(int musicTransportState) {
- // assumes at least one widget (besides camera + add)
- if (mAppWidgetToShow != AppWidgetManager.INVALID_APPWIDGET_ID) {
- final int childCount = mAppWidgetContainer.getChildCount();
- for (int i = 0; i < childCount; i++) {
- if (mAppWidgetContainer.getWidgetPageAt(i).getContentAppWidgetId()
- == mAppWidgetToShow) {
- return i;
- }
- }
- mAppWidgetToShow = AppWidgetManager.INVALID_APPWIDGET_ID;
- }
- // if music playing, show transport
- if (musicTransportState == TRANSPORT_VISIBLE) {
- if (DEBUG) Log.d(TAG, "Music playing, show transport");
- return mAppWidgetContainer.getWidgetPageIndex(getOrCreateTransportControl());
- }
-
- // else show the right-most widget (except for camera)
- int rightMost = mAppWidgetContainer.getChildCount() - 1;
- if (mAppWidgetContainer.isCameraPage(rightMost)) {
- rightMost--;
- }
- if (DEBUG) Log.d(TAG, "Show right-most page " + rightMost);
- return rightMost;
- }
-
- private void enableUserSelectorIfNecessary() {
- final UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
- if (um == null) {
- Throwable t = new Throwable();
- t.fillInStackTrace();
- Log.e(TAG, "user service is null.", t);
- return;
- }
-
- // if there are multiple users, we need to enable to multi-user switcher
- if (!um.isUserSwitcherEnabled()) {
- return;
- }
-
- final View multiUserView = findViewById(R.id.keyguard_user_selector);
- if (multiUserView == null) {
- if (DEBUG) Log.d(TAG, "can't find user_selector in layout.");
- return;
- }
-
- if (multiUserView instanceof KeyguardMultiUserSelectorView) {
- mKeyguardMultiUserSelectorView = (KeyguardMultiUserSelectorView) multiUserView;
- mKeyguardMultiUserSelectorView.setVisibility(View.VISIBLE);
- mKeyguardMultiUserSelectorView.addUsers(um.getUsers(true));
- UserSwitcherCallback callback = new UserSwitcherCallback() {
- @Override
- public void hideSecurityView(int duration) {
- getSecurityContainer().animate().alpha(0).setDuration(duration);
- }
-
- @Override
- public void showSecurityView() {
- getSecurityContainer().setAlpha(1.0f);
- }
-
- @Override
- public void showUnlockHint() {
- if (getSecurityContainer() != null) {
- getSecurityContainer().showUsabilityHint();
- }
- }
-
- @Override
- public void userActivity() {
- if (mViewMediatorCallback != null) {
- mViewMediatorCallback.userActivity();
- }
- }
- };
- mKeyguardMultiUserSelectorView.setCallback(callback);
- } else {
- Throwable t = new Throwable();
- t.fillInStackTrace();
- if (multiUserView == null) {
- Log.e(TAG, "could not find the user_selector.", t);
- } else {
- Log.e(TAG, "user_selector is the wrong type.", t);
- }
- }
+ mAudioManager.dispatchMediaKeyEvent(keyEvent);
}
@Override
- public void cleanUp() {
- // Make sure we let go of all widgets and their package contexts promptly. If we don't do
- // this, and the associated application is uninstalled, it can cause a soft reboot.
- int count = mAppWidgetContainer.getChildCount();
- for (int i = 0; i < count; i++) {
- KeyguardWidgetFrame frame = mAppWidgetContainer.getWidgetPageAt(i);
- frame.removeAllViews();
- }
- getSecurityContainer().onPause(); // clean up any actions in progress
- }
+ public void dispatchSystemUiVisibilityChanged(int visibility) {
+ super.dispatchSystemUiVisibilityChanged(visibility);
- public void goToWidget(int appWidgetId) {
- mAppWidgetToShow = appWidgetId;
- mSwitchPageRunnable.run();
- }
-
- @Override
- protected void showBouncer(boolean show) {
- super.showBouncer(show);
- mViewStateManager.showBouncer(show);
- }
-
- @Override
- public void onExternalMotionEvent(MotionEvent event) {
- mAppWidgetContainer.handleExternalCameraEvent(event);
- }
-
- @Override
- protected void onCreateOptions(Bundle options) {
- if (options != null) {
- int widgetToShow = options.getInt(LockPatternUtils.KEYGUARD_SHOW_APPWIDGET,
- AppWidgetManager.INVALID_APPWIDGET_ID);
- if (widgetToShow != AppWidgetManager.INVALID_APPWIDGET_ID) {
- goToWidget(widgetToShow);
- }
+ if (!(mContext instanceof Activity)) {
+ setSystemUiVisibility(STATUS_BAR_DISABLE_BACK);
}
}
+ /**
+ * In general, we enable unlocking the insecure keyguard with the menu key. However, there are
+ * some cases where we wish to disable it, notably when the menu button placement or technology
+ * is prone to false positives.
+ *
+ * @return true if the menu key should be enabled
+ */
+ private static final String ENABLE_MENU_KEY_FILE = "/data/local/enable_menu_key";
+ private boolean shouldEnableMenuKey() {
+ final Resources res = getResources();
+ final boolean configDisabled = res.getBoolean(R.bool.config_disableMenuKeyInLockScreen);
+ final boolean isTestHarness = ActivityManager.isRunningInTestHarness();
+ final boolean fileOverride = (new File(ENABLE_MENU_KEY_FILE)).exists();
+ return !configDisabled || isTestHarness || fileOverride;
+ }
+
+ public boolean handleMenuKey() {
+ // The following enables the MENU key to work for testing automation
+ if (shouldEnableMenuKey()) {
+ dismiss();
+ return true;
+ }
+ return false;
+ }
+
+ public void setViewMediatorCallback(ViewMediatorCallback viewMediatorCallback) {
+ mViewMediatorCallback = viewMediatorCallback;
+ // Update ViewMediator with the current input method requirements
+ mViewMediatorCallback.setNeedsInput(mSecurityContainer.needsInput());
+ }
+
+ public void setLockPatternUtils(LockPatternUtils utils) {
+ mLockPatternUtils = utils;
+ mSecurityContainer.setLockPatternUtils(utils);
+ }
+
+ public SecurityMode getSecurityMode() {
+ return mSecurityContainer.getSecurityMode();
+ }
+
+ public SecurityMode getCurrentSecurityMode() {
+ return mSecurityContainer.getCurrentSecurityMode();
+ }
+
+
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardLinearLayout.java b/packages/Keyguard/src/com/android/keyguard/KeyguardLinearLayout.java
deleted file mode 100644
index 343fdcb..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardLinearLayout.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.keyguard;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.LinearLayout;
-
-/**
- * A layout that arranges its children into a special type of grid.
- */
-public class KeyguardLinearLayout extends LinearLayout {
- int mTopChild = 0;
-
- public KeyguardLinearLayout(Context context) {
- this(context, null, 0);
- }
-
- public KeyguardLinearLayout(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public KeyguardLinearLayout(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- public void setTopChild(View child) {
- int top = indexOfChild(child);
- mTopChild = top;
- invalidate();
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserAvatar.java b/packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserAvatar.java
deleted file mode 100644
index 3aec55c..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserAvatar.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ValueAnimator.AnimatorUpdateListener;
-import android.animation.ValueAnimator;
-import android.content.Context;
-import android.content.pm.UserInfo;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Color;
-import android.os.UserManager;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-class KeyguardMultiUserAvatar extends FrameLayout {
- private static final String TAG = KeyguardMultiUserAvatar.class.getSimpleName();
- private static final boolean DEBUG = KeyguardConstants.DEBUG;
-
- private ImageView mUserImage;
- private TextView mUserName;
- private UserInfo mUserInfo;
- private static final float ACTIVE_ALPHA = 1.0f;
- private static final float INACTIVE_ALPHA = 1.0f;
- private static final float ACTIVE_SCALE = 1.5f;
- private static final float ACTIVE_TEXT_ALPHA = 0f;
- private static final float INACTIVE_TEXT_ALPHA = 0.5f;
- private static final int SWITCH_ANIMATION_DURATION = 150;
-
- private final float mActiveAlpha;
- private final float mActiveScale;
- private final float mActiveTextAlpha;
- private final float mInactiveAlpha;
- private final float mInactiveTextAlpha;
- private final float mShadowRadius;
- private final float mStroke;
- private final float mIconSize;
- private final int mFrameColor;
- private final int mFrameShadowColor;
- private final int mTextColor;
- private final int mHighlightColor;
-
- private boolean mTouched;
-
- private boolean mActive;
- private boolean mInit = true;
- private KeyguardMultiUserSelectorView mUserSelector;
- private KeyguardCircleFramedDrawable mFramed;
- private boolean mPressLock;
- private UserManager mUserManager;
-
- public static KeyguardMultiUserAvatar fromXml(int resId, Context context,
- KeyguardMultiUserSelectorView userSelector, UserInfo info) {
- KeyguardMultiUserAvatar icon = (KeyguardMultiUserAvatar)
- LayoutInflater.from(context).inflate(resId, userSelector, false);
-
- icon.init(info, userSelector);
- return icon;
- }
-
- public KeyguardMultiUserAvatar(Context context) {
- this(context, null, 0);
- }
-
- public KeyguardMultiUserAvatar(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public KeyguardMultiUserAvatar(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
-
- Resources res = mContext.getResources();
- mTextColor = res.getColor(R.color.keyguard_avatar_nick_color);
- mIconSize = res.getDimension(R.dimen.keyguard_avatar_size);
- mStroke = res.getDimension(R.dimen.keyguard_avatar_frame_stroke_width);
- mShadowRadius = res.getDimension(R.dimen.keyguard_avatar_frame_shadow_radius);
- mFrameColor = res.getColor(R.color.keyguard_avatar_frame_color);
- mFrameShadowColor = res.getColor(R.color.keyguard_avatar_frame_shadow_color);
- mHighlightColor = res.getColor(R.color.keyguard_avatar_frame_pressed_color);
- mActiveTextAlpha = ACTIVE_TEXT_ALPHA;
- mInactiveTextAlpha = INACTIVE_TEXT_ALPHA;
- mActiveScale = ACTIVE_SCALE;
- mActiveAlpha = ACTIVE_ALPHA;
- mInactiveAlpha = INACTIVE_ALPHA;
- mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
-
- mTouched = false;
-
- setLayerType(View.LAYER_TYPE_SOFTWARE, null);
- }
-
- protected String rewriteIconPath(String path) {
- return path;
- }
-
- public void init(UserInfo user, KeyguardMultiUserSelectorView userSelector) {
- mUserInfo = user;
- mUserSelector = userSelector;
-
- mUserImage = (ImageView) findViewById(R.id.keyguard_user_avatar);
- mUserName = (TextView) findViewById(R.id.keyguard_user_name);
-
- mFramed = (KeyguardCircleFramedDrawable)
- MultiUserAvatarCache.getInstance().get(user.id);
-
- // If we can't find it or the params don't match, create the drawable again
- if (mFramed == null
- || !mFramed.verifyParams(mIconSize, mFrameColor, mStroke, mFrameShadowColor,
- mShadowRadius, mHighlightColor)) {
- Bitmap icon = null;
- try {
- icon = mUserManager.getUserIcon(user.id);
- } catch (Exception e) {
- if (DEBUG) Log.d(TAG, "failed to get profile icon " + user, e);
- }
-
- if (icon == null) {
- icon = BitmapFactory.decodeResource(mContext.getResources(),
- com.android.internal.R.drawable.ic_contact_picture);
- }
-
- mFramed = new KeyguardCircleFramedDrawable(icon, (int) mIconSize, mFrameColor, mStroke,
- mFrameShadowColor, mShadowRadius, mHighlightColor);
- MultiUserAvatarCache.getInstance().put(user.id, mFramed);
- }
-
- mFramed.reset();
-
- mUserImage.setImageDrawable(mFramed);
- mUserName.setText(mUserInfo.name);
- setOnClickListener(mUserSelector);
- mInit = false;
- }
-
- public void setActive(boolean active, boolean animate, final Runnable onComplete) {
- if (mActive != active || mInit) {
- mActive = active;
-
- if (active) {
- KeyguardLinearLayout parent = (KeyguardLinearLayout) getParent();
- parent.setTopChild(this);
- // TODO: Create an appropriate asset when string changes are possible.
- setContentDescription(mUserName.getText()
- + ". " + mContext.getString(R.string.user_switched, ""));
- } else {
- setContentDescription(mUserName.getText());
- }
- }
- updateVisualsForActive(mActive, animate, SWITCH_ANIMATION_DURATION, onComplete);
- }
-
- void updateVisualsForActive(boolean active, boolean animate, int duration,
- final Runnable onComplete) {
- final float finalAlpha = active ? mActiveAlpha : mInactiveAlpha;
- final float initAlpha = active ? mInactiveAlpha : mActiveAlpha;
- final float finalScale = active ? 1f : 1f / mActiveScale;
- final float initScale = mFramed.getScale();
- final int finalTextAlpha = active ? (int) (mActiveTextAlpha * 255) :
- (int) (mInactiveTextAlpha * 255);
- final int initTextAlpha = active ? (int) (mInactiveTextAlpha * 255) :
- (int) (mActiveTextAlpha * 255);
- int textColor = mTextColor;
- mUserName.setTextColor(textColor);
-
- if (animate && mTouched) {
- ValueAnimator va = ValueAnimator.ofFloat(0f, 1f);
- va.addUpdateListener(new AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
- float r = animation.getAnimatedFraction();
- float scale = (1 - r) * initScale + r * finalScale;
- float alpha = (1 - r) * initAlpha + r * finalAlpha;
- int textAlpha = (int) ((1 - r) * initTextAlpha + r * finalTextAlpha);
- mFramed.setScale(scale);
- mUserImage.setAlpha(alpha);
- mUserName.setTextColor(Color.argb(textAlpha, 255, 255, 255));
- mUserImage.invalidate();
- }
- });
- va.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- if (onComplete != null) {
- onComplete.run();
- }
- }
- });
- va.setDuration(duration);
- va.start();
- } else {
- mFramed.setScale(finalScale);
- mUserImage.setAlpha(finalAlpha);
- mUserName.setTextColor(Color.argb(finalTextAlpha, 255, 255, 255));
- if (onComplete != null) {
- post(onComplete);
- }
- }
-
- mTouched = true;
- }
-
- @Override
- public void setPressed(boolean pressed) {
- if (mPressLock && !pressed) {
- return;
- }
-
- if (mPressLock || !pressed || isClickable()) {
- super.setPressed(pressed);
- mFramed.setPressed(pressed);
- mUserImage.invalidate();
- }
- }
-
- public void lockPressed(boolean pressed) {
- mPressLock = pressed;
- setPressed(pressed);
- }
-
- public UserInfo getUserInfo() {
- return mUserInfo;
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserSelectorView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserSelectorView.java
deleted file mode 100644
index 06815e1..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserSelectorView.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import android.app.ActivityManagerNative;
-import android.content.Context;
-import android.content.pm.UserInfo;
-import android.os.RemoteException;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.FrameLayout;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-
-public class KeyguardMultiUserSelectorView extends FrameLayout implements View.OnClickListener {
- private static final String TAG = "KeyguardMultiUserSelectorView";
-
- private ViewGroup mUsersGrid;
- private KeyguardMultiUserAvatar mActiveUserAvatar;
- private KeyguardHostView.UserSwitcherCallback mCallback;
- private static final int FADE_OUT_ANIMATION_DURATION = 100;
-
- public KeyguardMultiUserSelectorView(Context context) {
- this(context, null, 0);
- }
-
- public KeyguardMultiUserSelectorView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public KeyguardMultiUserSelectorView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- protected void onFinishInflate () {
- mUsersGrid = (ViewGroup) findViewById(R.id.keyguard_users_grid);
- mUsersGrid.removeAllViews();
- setClipChildren(false);
- setClipToPadding(false);
-
- }
-
- public void setCallback(KeyguardHostView.UserSwitcherCallback callback) {
- mCallback = callback;
- }
-
- public void addUsers(Collection<UserInfo> userList) {
- UserInfo activeUser;
- try {
- activeUser = ActivityManagerNative.getDefault().getCurrentUser();
- } catch (RemoteException re) {
- activeUser = null;
- }
-
- ArrayList<UserInfo> users = new ArrayList<UserInfo>(userList);
- Collections.sort(users, mOrderAddedComparator);
-
- for (UserInfo user: users) {
- if (user.supportsSwitchTo()) {
- KeyguardMultiUserAvatar uv = createAndAddUser(user);
- if (user.id == activeUser.id) {
- mActiveUserAvatar = uv;
- }
- uv.setActive(false, false, null);
- }
- }
- mActiveUserAvatar.lockPressed(true);
- }
-
- public void finalizeActiveUserView(boolean animate) {
- if (animate) {
- getHandler().postDelayed(new Runnable() {
- @Override
- public void run() {
- finalizeActiveUserNow(true);
- }
- }, 500);
- } else {
- finalizeActiveUserNow(animate);
- }
- }
-
- void finalizeActiveUserNow(boolean animate) {
- mActiveUserAvatar.lockPressed(false);
- mActiveUserAvatar.setActive(true, animate, null);
- }
-
- Comparator<UserInfo> mOrderAddedComparator = new Comparator<UserInfo>() {
- @Override
- public int compare(UserInfo lhs, UserInfo rhs) {
- return (lhs.serialNumber - rhs.serialNumber);
- }
- };
-
- private KeyguardMultiUserAvatar createAndAddUser(UserInfo user) {
- KeyguardMultiUserAvatar uv = KeyguardMultiUserAvatar.fromXml(
- R.layout.keyguard_multi_user_avatar, mContext, this, user);
- mUsersGrid.addView(uv);
- return uv;
- }
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent event) {
- if(event.getActionMasked() != MotionEvent.ACTION_CANCEL && mCallback != null) {
- mCallback.userActivity();
- }
- return false;
- }
-
- private void setAllClickable(boolean clickable)
- {
- for(int i = 0; i < mUsersGrid.getChildCount(); i++) {
- View v = mUsersGrid.getChildAt(i);
- v.setClickable(clickable);
- v.setPressed(false);
- }
- }
-
- @Override
- public void onClick(View v) {
- if (!(v instanceof KeyguardMultiUserAvatar)) return;
- final KeyguardMultiUserAvatar avatar = (KeyguardMultiUserAvatar) v;
- if (avatar.isClickable()) { // catch race conditions
- if (mActiveUserAvatar == avatar) {
- // If they click the currently active user, show the unlock hint
- mCallback.showUnlockHint();
- return;
- } else {
- // Reset the previously active user to appear inactive
- mCallback.hideSecurityView(FADE_OUT_ANIMATION_DURATION);
- setAllClickable(false);
- avatar.lockPressed(true);
- mActiveUserAvatar.setActive(false, true, new Runnable() {
- @Override
- public void run() {
- mActiveUserAvatar = avatar;
- try {
- ActivityManagerNative.getDefault()
- .switchUser(avatar.getUserInfo().id);
- } catch (RemoteException re) {
- Log.e(TAG, "Couldn't switch user " + re);
- }
- }
- });
- }
- }
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java
index 04ef57e..d0be855 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java
@@ -29,7 +29,7 @@
private final AppearAnimationUtils mAppearAnimationUtils;
private final DisappearAnimationUtils mDisappearAnimationUtils;
- private ViewGroup mKeyguardBouncerFrame;
+ private ViewGroup mContainer;
private ViewGroup mRow0;
private ViewGroup mRow1;
private ViewGroup mRow2;
@@ -55,11 +55,7 @@
protected void resetState() {
super.resetState();
- if (KeyguardUpdateMonitor.getInstance(mContext).getMaxBiometricUnlockAttemptsReached()) {
- mSecurityMessageDisplay.setMessage(R.string.faceunlock_multiple_failures, true);
- } else {
- mSecurityMessageDisplay.setMessage(R.string.kg_pin_instructions, false);
- }
+ mSecurityMessageDisplay.setMessage(R.string.kg_pin_instructions, false);
}
@Override
@@ -71,7 +67,7 @@
protected void onFinishInflate() {
super.onFinishInflate();
- mKeyguardBouncerFrame = (ViewGroup) findViewById(R.id.keyguard_bouncer_frame);
+ mContainer = (ViewGroup) findViewById(R.id.container);
mRow0 = (ViewGroup) findViewById(R.id.row0);
mRow1 = (ViewGroup) findViewById(R.id.row1);
mRow2 = (ViewGroup) findViewById(R.id.row2);
@@ -150,8 +146,8 @@
}
private void enableClipping(boolean enable) {
- mKeyguardBouncerFrame.setClipToPadding(enable);
- mKeyguardBouncerFrame.setClipChildren(enable);
+ mContainer.setClipToPadding(enable);
+ mContainer.setClipChildren(enable);
mRow1.setClipToPadding(enable);
mRow2.setClipToPadding(enable);
mRow3.setClipToPadding(enable);
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
index 0dfe1dc..62f1b69 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
@@ -20,7 +20,6 @@
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
import android.os.CountDownTimer;
import android.os.SystemClock;
import android.text.TextUtils;
@@ -81,8 +80,7 @@
private Rect mTempRect = new Rect();
private SecurityMessageDisplay mSecurityMessageDisplay;
private View mEcaView;
- private Drawable mBouncerFrame;
- private ViewGroup mKeyguardBouncerFrame;
+ private ViewGroup mContainer;
private KeyguardMessageArea mHelpMessage;
private int mDisappearYTranslation;
@@ -140,12 +138,7 @@
mSecurityMessageDisplay = new KeyguardMessageArea.Helper(this);
mEcaView = findViewById(R.id.keyguard_selector_fade_container);
- View bouncerFrameView = findViewById(R.id.keyguard_bouncer_frame);
- if (bouncerFrameView != null) {
- mBouncerFrame = bouncerFrameView.getBackground();
- }
-
- mKeyguardBouncerFrame = (ViewGroup) findViewById(R.id.keyguard_bouncer_frame);
+ mContainer = (ViewGroup) findViewById(R.id.container);
mHelpMessage = (KeyguardMessageArea) findViewById(R.id.keyguard_message_area);
}
@@ -182,11 +175,7 @@
}
private void displayDefaultSecurityMessage() {
- if (mKeyguardUpdateMonitor.getMaxBiometricUnlockAttemptsReached()) {
- mSecurityMessageDisplay.setMessage(R.string.faceunlock_multiple_failures, true);
- } else {
- mSecurityMessageDisplay.setMessage(R.string.kg_pattern_instructions, false);
- }
+ mSecurityMessageDisplay.setMessage(R.string.kg_pattern_instructions, false);
}
@Override
@@ -288,18 +277,6 @@
}
@Override
- public void showBouncer(int duration) {
- KeyguardSecurityViewHelper.
- showBouncer(mSecurityMessageDisplay, mEcaView, mBouncerFrame, duration);
- }
-
- @Override
- public void hideBouncer(int duration) {
- KeyguardSecurityViewHelper.
- hideBouncer(mSecurityMessageDisplay, mEcaView, mBouncerFrame, duration);
- }
-
- @Override
public void startAppearAnimation() {
enableClipping(false);
setAlpha(1f);
@@ -359,8 +336,8 @@
private void enableClipping(boolean enable) {
setClipChildren(enable);
- mKeyguardBouncerFrame.setClipToPadding(enable);
- mKeyguardBouncerFrame.setClipChildren(enable);
+ mContainer.setClipToPadding(enable);
+ mContainer.setClipChildren(enable);
}
@Override
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
index faecaed..4f5638b 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
@@ -20,7 +20,6 @@
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.os.UserHandle;
-import android.os.UserManager;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Slog;
@@ -41,13 +40,11 @@
private static final int USER_TYPE_SECONDARY_USER = 3;
private KeyguardSecurityModel mSecurityModel;
- private boolean mEnableFallback; // TODO: This should get the value from KeyguardPatternView
private LockPatternUtils mLockPatternUtils;
private KeyguardSecurityViewFlipper mSecurityViewFlipper;
private boolean mIsVerifyUnlockOnly;
private SecurityMode mCurrentSecuritySelection = SecurityMode.Invalid;
- private boolean mIsBouncing;
private SecurityCallback mSecurityCallback;
private final KeyguardUpdateMonitor mUpdateMonitor;
@@ -107,13 +104,6 @@
return false;
}
- void updateSecurityViews(boolean isBouncing) {
- int children = mSecurityViewFlipper.getChildCount();
- for (int i = 0; i < children; i++) {
- updateSecurityView(mSecurityViewFlipper.getChildAt(i), isBouncing);
- }
- }
-
public void announceCurrentSecurityMethod() {
View v = (View) getSecurityView(mCurrentSecuritySelection);
if (v != null) {
@@ -137,24 +127,18 @@
if (DEBUG) Log.v(TAG, "inflating id = " + layoutId);
View v = inflater.inflate(layoutId, mSecurityViewFlipper, false);
mSecurityViewFlipper.addView(v);
- updateSecurityView(v, mIsBouncing);
+ updateSecurityView(v);
view = (KeyguardSecurityView)v;
}
return view;
}
- private void updateSecurityView(View view, boolean isBouncing) {
- mIsBouncing = isBouncing;
+ private void updateSecurityView(View view) {
if (view instanceof KeyguardSecurityView) {
KeyguardSecurityView ksv = (KeyguardSecurityView) view;
ksv.setKeyguardCallback(mCallback);
ksv.setLockPatternUtils(mLockPatternUtils);
- if (isBouncing) {
- ksv.showBouncer(0);
- } else {
- ksv.hideBouncer(0);
- }
} else {
Log.w(TAG, "View " + view + " is not a KeyguardSecurityView");
}
@@ -198,8 +182,6 @@
messageId = R.string.kg_too_many_failed_password_attempts_dialog_message;
break;
// These don't have timeout dialogs.
- case Account:
- case Biometric:
case Invalid:
case None:
case SimPin:
@@ -306,17 +288,6 @@
} else {
showTimeout =
(failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0;
- if (usingPattern && mEnableFallback) {
- if (failedAttempts == failedAttemptWarning) {
- showAlmostAtAccountLoginDialog();
- showTimeout = false; // don't show both dialogs
- } else if (failedAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET) {
- mLockPatternUtils.setPermanentlyLocked(true);
- showSecurityScreen(SecurityMode.Account);
- // don't show timeout dialog because we show account unlock screen next
- showTimeout = false;
- }
- }
}
monitor.reportFailedUnlockAttempt();
mLockPatternUtils.reportFailedPasswordAttempt();
@@ -356,7 +327,6 @@
/**
* Shows the next security screen if there is one.
* @param authenticated true if the user entered the correct authentication
- * @param authenticated
* @return true if keyguard is done
*/
boolean showNextSecurityScreenOrFinish(boolean authenticated) {
@@ -378,8 +348,6 @@
case Pattern:
case Password:
case PIN:
- case Account:
- case Biometric:
finish = true;
break;
@@ -456,20 +424,6 @@
return null;
}
- public void showBouncer(int duration) {
- KeyguardSecurityViewFlipper flipper = getFlipper();
- if (flipper != null) {
- flipper.showBouncer(duration);
- }
- }
-
- public void hideBouncer(int duration) {
- KeyguardSecurityViewFlipper flipper = getFlipper();
- if (flipper != null) {
- flipper.hideBouncer(duration);
- }
- }
-
private KeyguardSecurityCallback mCallback = new KeyguardSecurityCallback() {
public void userActivity() {
@@ -492,11 +446,7 @@
monitor.clearFailedUnlockAttempts();
mLockPatternUtils.reportSuccessfulPasswordAttempt();
} else {
- if (mCurrentSecuritySelection == SecurityMode.Biometric) {
- monitor.reportFailedBiometricUnlockAttempt();
- } else {
- KeyguardSecurityContainer.this.reportFailedUnlockAttempt();
- }
+ KeyguardSecurityContainer.this.reportFailedUnlockAttempt();
}
}
@@ -528,8 +478,6 @@
case Pattern: return R.id.keyguard_pattern_view;
case PIN: return R.id.keyguard_pin_view;
case Password: return R.id.keyguard_password_view;
- case Biometric: return R.id.keyguard_face_unlock_view;
- case Account: return R.id.keyguard_account_view;
case SimPin: return R.id.keyguard_sim_pin_view;
case SimPuk: return R.id.keyguard_sim_puk_view;
}
@@ -541,8 +489,6 @@
case Pattern: return R.layout.keyguard_pattern_view;
case PIN: return R.layout.keyguard_pin_view;
case Password: return R.layout.keyguard_password_view;
- case Biometric: return R.layout.keyguard_face_unlock_view;
- case Account: return R.layout.keyguard_account_view;
case SimPin: return R.layout.keyguard_sim_pin_view;
case SimPuk: return R.layout.keyguard_sim_puk_view;
default:
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityModel.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityModel.java
index 1e2a233..11f7c63 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityModel.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityModel.java
@@ -38,8 +38,6 @@
Pattern, // Unlock by drawing a pattern.
Password, // Unlock by entering an alphanumeric password
PIN, // Strictly numeric password
- Biometric, // Unlock with a biometric key (e.g. finger print or face unlock)
- Account, // Unlock by entering an account's login and password.
SimPin, // Unlock by entering a sim pin.
SimPuk // Unlock by entering a sim puk
}
@@ -56,28 +54,6 @@
mLockPatternUtils = utils;
}
- /**
- * Returns true if biometric unlock is installed and selected. If this returns false there is
- * no need to even construct the biometric unlock.
- */
- boolean isBiometricUnlockEnabled() {
- return mLockPatternUtils.usingBiometricWeak()
- && mLockPatternUtils.isBiometricWeakInstalled();
- }
-
- /**
- * Returns true if a condition is currently suppressing the biometric unlock. If this returns
- * true there is no need to even construct the biometric unlock.
- */
- private boolean isBiometricUnlockSuppressed() {
- KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
- final boolean backupIsTimedOut = monitor.getFailedUnlockAttempts() >=
- LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT;
- return monitor.getMaxBiometricUnlockAttemptsReached() || backupIsTimedOut
- || !monitor.isAlternateUnlockEnabled()
- || monitor.getPhoneState() != TelephonyManager.CALL_STATE_IDLE;
- }
-
SecurityMode getSecurityMode() {
KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
SecurityMode mode = SecurityMode.None;
@@ -105,10 +81,8 @@
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
case DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED:
- if (mLockPatternUtils.isLockPatternEnabled()) {
- mode = mLockPatternUtils.isPermanentlyLocked() ?
- SecurityMode.Account : SecurityMode.Pattern;
- }
+ mode = mLockPatternUtils.isLockPatternEnabled() ?
+ SecurityMode.Pattern : SecurityMode.None;
break;
default:
@@ -127,12 +101,6 @@
* @return alternate or the given mode
*/
SecurityMode getAlternateFor(SecurityMode mode) {
- if (isBiometricUnlockEnabled() && !isBiometricUnlockSuppressed()
- && (mode == SecurityMode.Password
- || mode == SecurityMode.PIN
- || mode == SecurityMode.Pattern)) {
- return SecurityMode.Biometric;
- }
return mode; // no alternate, return what was given
}
@@ -143,12 +111,6 @@
* @return backup method or current security mode
*/
SecurityMode getBackupSecurityMode(SecurityMode mode) {
- switch(mode) {
- case Biometric:
- return getSecurityMode();
- case Pattern:
- return SecurityMode.Account;
- }
return mode; // no backup, return current security mode
}
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityView.java
index 78fcb9f..5b50236 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityView.java
@@ -72,20 +72,6 @@
void showUsabilityHint();
/**
- * Place the security view into bouncer mode.
- * Animate transisiton if duration is non-zero.
- * @param duration millisends for the transisiton animation.
- */
- void showBouncer(int duration);
-
- /**
- * Place the security view into non-bouncer mode.
- * Animate transisiton if duration is non-zero.
- * @param duration millisends for the transisiton animation.
- */
- void hideBouncer(int duration);
-
- /**
* Starts the animation which should run when the security view appears.
*/
void startAppearAnimation();
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java
index ea5c304..b5eda90 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java
@@ -135,30 +135,6 @@
}
@Override
- public void showBouncer(int duration) {
- KeyguardSecurityView active = getSecurityView();
- for (int i = 0; i < getChildCount(); i++) {
- View child = getChildAt(i);
- if (child instanceof KeyguardSecurityView) {
- KeyguardSecurityView ksv = (KeyguardSecurityView) child;
- ksv.showBouncer(ksv == active ? duration : 0);
- }
- }
- }
-
- @Override
- public void hideBouncer(int duration) {
- KeyguardSecurityView active = getSecurityView();
- for (int i = 0; i < getChildCount(); i++) {
- View child = getChildAt(i);
- if (child instanceof KeyguardSecurityView) {
- KeyguardSecurityView ksv = (KeyguardSecurityView) child;
- ksv.hideBouncer(ksv == active ? duration : 0);
- }
- }
- }
-
- @Override
public void startAppearAnimation() {
KeyguardSecurityView ksv = getSecurityView();
if (ksv != null) {
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewHelper.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewHelper.java
deleted file mode 100644
index 67a6f52..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewHelper.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
-import android.graphics.drawable.Drawable;
-import android.view.View;
-
-/**
- * Some common functions that are useful for KeyguardSecurityViews.
- */
-public class KeyguardSecurityViewHelper {
-
- public static void showBouncer(SecurityMessageDisplay securityMessageDisplay,
- final View ecaView, Drawable bouncerFrame, int duration) {
- if (securityMessageDisplay != null) {
- securityMessageDisplay.showBouncer(duration);
- }
- if (ecaView != null) {
- if (duration > 0) {
- Animator anim = ObjectAnimator.ofFloat(ecaView, "alpha", 0f);
- anim.setDuration(duration);
- anim.addListener(new AnimatorListenerAdapter() {
- private boolean mCanceled;
- @Override
- public void onAnimationCancel(Animator animation) {
- // Fail safe and show the emergency button in onAnimationEnd()
- mCanceled = true;
- ecaView.setAlpha(1f);
- }
- @Override
- public void onAnimationEnd(Animator animation) {
- ecaView.setVisibility(mCanceled ? View.VISIBLE : View.INVISIBLE);
- }
- });
- anim.start();
- } else {
- ecaView.setAlpha(0f);
- ecaView.setVisibility(View.INVISIBLE);
- }
- }
- if (bouncerFrame != null) {
- if (duration > 0) {
- Animator anim = ObjectAnimator.ofInt(bouncerFrame, "alpha", 0, 255);
- anim.setDuration(duration);
- anim.start();
- } else {
- bouncerFrame.setAlpha(255);
- }
- }
- }
-
- public static void hideBouncer(SecurityMessageDisplay securityMessageDisplay,
- View ecaView, Drawable bouncerFrame, int duration) {
- if (securityMessageDisplay != null) {
- securityMessageDisplay.hideBouncer(duration);
- }
- if (ecaView != null) {
- ecaView.setVisibility(View.VISIBLE);
- if (duration > 0) {
- Animator anim = ObjectAnimator.ofFloat(ecaView, "alpha", 1f);
- anim.setDuration(duration);
- anim.start();
- } else {
- ecaView.setAlpha(1f);
- }
- }
- if (bouncerFrame != null) {
- if (duration > 0) {
- Animator anim = ObjectAnimator.ofInt(bouncerFrame, "alpha", 255, 0);
- anim.setDuration(duration);
- anim.start();
- } else {
- bouncerFrame.setAlpha(0);
- }
- }
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java
deleted file mode 100644
index 828c921..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import android.content.Context;
-import android.os.Bundle;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-
-public class KeyguardSimpleHostView extends KeyguardViewBase {
-
- public KeyguardSimpleHostView(Context context, AttributeSet attrs) {
- super(context, attrs);
- KeyguardUpdateMonitor.getInstance(context).registerCallback(mUpdateCallback);
- }
-
- @Override
- protected void showBouncer(boolean show) {
- super.showBouncer(show);
- if (show) {
- getSecurityContainer().showBouncer(250);
- } else {
- getSecurityContainer().hideBouncer(250);
- }
- }
-
- @Override
- public void cleanUp() {
- getSecurityContainer().onPause();
- }
-
- @Override
- public long getUserActivityTimeout() {
- return -1; // not used
- }
-
- @Override
- protected void onUserSwitching(boolean switching) {
- // TODO Auto-generated method stub
- }
-
- @Override
- protected void onCreateOptions(Bundle options) {
- // TODO Auto-generated method stub
- }
-
- @Override
- protected void onExternalMotionEvent(MotionEvent event) {
- // TODO Auto-generated method stub
- }
-
- private KeyguardUpdateMonitorCallback mUpdateCallback = new KeyguardUpdateMonitorCallback() {
- @Override
- public void onUserSwitchComplete(int userId) {
- getSecurityContainer().showPrimarySecurityScreen(false /* turning off */);
- }
-
- @Override
- public void onTrustInitiatedByUser(int userId) {
- if (userId != mLockPatternUtils.getCurrentUser()) return;
- if (!isAttachedToWindow()) return;
-
- if (isVisibleToUser()) {
- dismiss(false /* authenticated */);
- } else {
- mViewMediatorCallback.playTrustedSound();
- }
- }
- };
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardStatusViewManager.java b/packages/Keyguard/src/com/android/keyguard/KeyguardStatusViewManager.java
deleted file mode 100644
index e69de29..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardStatusViewManager.java
+++ /dev/null
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java
deleted file mode 100644
index 0d472ae..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java
+++ /dev/null
@@ -1,716 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.content.res.Configuration;
-import android.graphics.Bitmap;
-import android.graphics.ColorMatrix;
-import android.graphics.ColorMatrixColorFilter;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffXfermode;
-import android.graphics.drawable.Drawable;
-import android.media.AudioManager;
-import android.media.MediaMetadataEditor;
-import android.media.MediaMetadataRetriever;
-import android.media.RemoteControlClient;
-import android.media.RemoteController;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.text.TextUtils;
-import android.text.format.DateFormat;
-import android.transition.ChangeBounds;
-import android.transition.ChangeText;
-import android.transition.Fade;
-import android.transition.TransitionManager;
-import android.transition.TransitionSet;
-import android.util.AttributeSet;
-import android.util.DisplayMetrics;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.TimeZone;
-
-/**
- * This is the widget responsible for showing music controls in keyguard.
- */
-public class KeyguardTransportControlView extends FrameLayout {
-
- private static final int RESET_TO_METADATA_DELAY = 5000;
- protected static final boolean DEBUG = KeyguardConstants.DEBUG;
- protected static final String TAG = "TransportControlView";
-
- private static final boolean ANIMATE_TRANSITIONS = true;
- protected static final long QUIESCENT_PLAYBACK_FACTOR = 1000;
-
- private ViewGroup mMetadataContainer;
- private ViewGroup mInfoContainer;
- private TextView mTrackTitle;
- private TextView mTrackArtistAlbum;
-
- private View mTransientSeek;
- private SeekBar mTransientSeekBar;
- private TextView mTransientSeekTimeElapsed;
- private TextView mTransientSeekTimeTotal;
-
- private ImageView mBtnPrev;
- private ImageView mBtnPlay;
- private ImageView mBtnNext;
- private Metadata mMetadata = new Metadata();
- private int mTransportControlFlags;
- private int mCurrentPlayState;
- private AudioManager mAudioManager;
- private RemoteController mRemoteController;
-
- private ImageView mBadge;
-
- private boolean mSeekEnabled;
- private java.text.DateFormat mFormat;
-
- private Date mTempDate = new Date();
-
- /**
- * The metadata which should be populated into the view once we've been attached
- */
- private RemoteController.MetadataEditor mPopulateMetadataWhenAttached = null;
-
- private RemoteController.OnClientUpdateListener mRCClientUpdateListener =
- new RemoteController.OnClientUpdateListener() {
- @Override
- public void onClientChange(boolean clearing) {
- if (clearing) {
- clearMetadata();
- }
- }
-
- @Override
- public void onClientPlaybackStateUpdate(int state) {
- updatePlayPauseState(state);
- }
-
- @Override
- public void onClientPlaybackStateUpdate(int state, long stateChangeTimeMs,
- long currentPosMs, float speed) {
- updatePlayPauseState(state);
- if (DEBUG) Log.d(TAG, "onClientPlaybackStateUpdate(state=" + state +
- ", stateChangeTimeMs=" + stateChangeTimeMs + ", currentPosMs=" + currentPosMs +
- ", speed=" + speed + ")");
-
- removeCallbacks(mUpdateSeekBars);
- // Since the music client may be responding to historical events that cause the
- // playback state to change dramatically, wait until things become quiescent before
- // resuming automatic scrub position update.
- if (mTransientSeek.getVisibility() == View.VISIBLE
- && playbackPositionShouldMove(mCurrentPlayState)) {
- postDelayed(mUpdateSeekBars, QUIESCENT_PLAYBACK_FACTOR);
- }
- }
-
- @Override
- public void onClientTransportControlUpdate(int transportControlFlags) {
- updateTransportControls(transportControlFlags);
- }
-
- @Override
- public void onClientMetadataUpdate(RemoteController.MetadataEditor metadataEditor) {
- updateMetadata(metadataEditor);
- }
- };
-
- private class UpdateSeekBarRunnable implements Runnable {
- public void run() {
- boolean seekAble = updateOnce();
- if (seekAble) {
- removeCallbacks(this);
- postDelayed(this, 1000);
- }
- }
- public boolean updateOnce() {
- return updateSeekBars();
- }
- };
-
- private final UpdateSeekBarRunnable mUpdateSeekBars = new UpdateSeekBarRunnable();
-
- private final Runnable mResetToMetadata = new Runnable() {
- public void run() {
- resetToMetadata();
- }
- };
-
- private final OnClickListener mTransportCommandListener = new OnClickListener() {
- public void onClick(View v) {
- int keyCode = -1;
- if (v == mBtnPrev) {
- keyCode = KeyEvent.KEYCODE_MEDIA_PREVIOUS;
- } else if (v == mBtnNext) {
- keyCode = KeyEvent.KEYCODE_MEDIA_NEXT;
- } else if (v == mBtnPlay) {
- keyCode = KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE;
- }
- if (keyCode != -1) {
- sendMediaButtonClick(keyCode);
- delayResetToMetadata(); // if the scrub bar is showing, keep showing it.
- }
- }
- };
-
- private final OnLongClickListener mTransportShowSeekBarListener = new OnLongClickListener() {
- @Override
- public boolean onLongClick(View v) {
- if (mSeekEnabled) {
- return tryToggleSeekBar();
- }
- return false;
- }
- };
-
- // This class is here to throttle scrub position updates to the music client
- class FutureSeekRunnable implements Runnable {
- private int mProgress;
- private boolean mPending;
-
- public void run() {
- scrubTo(mProgress);
- mPending = false;
- }
-
- void setProgress(int progress) {
- mProgress = progress;
- if (!mPending) {
- mPending = true;
- postDelayed(this, 30);
- }
- }
- };
-
- // This is here because RemoteControlClient's method isn't visible :/
- private final static boolean playbackPositionShouldMove(int playstate) {
- switch(playstate) {
- case RemoteControlClient.PLAYSTATE_STOPPED:
- case RemoteControlClient.PLAYSTATE_PAUSED:
- case RemoteControlClient.PLAYSTATE_BUFFERING:
- case RemoteControlClient.PLAYSTATE_ERROR:
- case RemoteControlClient.PLAYSTATE_SKIPPING_FORWARDS:
- case RemoteControlClient.PLAYSTATE_SKIPPING_BACKWARDS:
- return false;
- case RemoteControlClient.PLAYSTATE_PLAYING:
- case RemoteControlClient.PLAYSTATE_FAST_FORWARDING:
- case RemoteControlClient.PLAYSTATE_REWINDING:
- default:
- return true;
- }
- }
-
- private final FutureSeekRunnable mFutureSeekRunnable = new FutureSeekRunnable();
-
- private final SeekBar.OnSeekBarChangeListener mOnSeekBarChangeListener =
- new SeekBar.OnSeekBarChangeListener() {
- @Override
- public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- if (fromUser) {
- mFutureSeekRunnable.setProgress(progress);
- delayResetToMetadata();
- mTempDate.setTime(progress);
- mTransientSeekTimeElapsed.setText(mFormat.format(mTempDate));
- } else {
- updateSeekDisplay();
- }
- }
-
- @Override
- public void onStartTrackingTouch(SeekBar seekBar) {
- delayResetToMetadata();
- removeCallbacks(mUpdateSeekBars); // don't update during user interaction
- }
-
- @Override
- public void onStopTrackingTouch(SeekBar seekBar) {
- }
- };
-
- private static final int TRANSITION_DURATION = 200;
- private final TransitionSet mMetadataChangeTransition;
-
- KeyguardHostView.TransportControlCallback mTransportControlCallback;
-
- private final KeyguardUpdateMonitorCallback mUpdateMonitor
- = new KeyguardUpdateMonitorCallback() {
- public void onScreenTurnedOff(int why) {
- setEnableMarquee(false);
- }
- public void onScreenTurnedOn() {
- setEnableMarquee(true);
- }
- };
-
- public KeyguardTransportControlView(Context context, AttributeSet attrs) {
- super(context, attrs);
- if (DEBUG) Log.v(TAG, "Create TCV " + this);
- mAudioManager = new AudioManager(mContext);
- mCurrentPlayState = RemoteControlClient.PLAYSTATE_NONE; // until we get a callback
- mRemoteController = new RemoteController(context, mRCClientUpdateListener);
-
- final DisplayMetrics dm = context.getResources().getDisplayMetrics();
- final int dim = Math.max(dm.widthPixels, dm.heightPixels);
- mRemoteController.setArtworkConfiguration(true, dim, dim);
-
- final ChangeText tc = new ChangeText();
- tc.setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT_IN);
- final TransitionSet inner = new TransitionSet();
- inner.addTransition(tc).addTransition(new ChangeBounds());
- final TransitionSet tg = new TransitionSet();
- tg.addTransition(new Fade(Fade.OUT)).addTransition(inner).
- addTransition(new Fade(Fade.IN));
- tg.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
- tg.setDuration(TRANSITION_DURATION);
- mMetadataChangeTransition = tg;
- }
-
- private void updateTransportControls(int transportControlFlags) {
- mTransportControlFlags = transportControlFlags;
- setSeekBarsEnabled(
- (transportControlFlags & RemoteControlClient.FLAG_KEY_MEDIA_POSITION_UPDATE) != 0);
- }
-
- void setSeekBarsEnabled(boolean enabled) {
- if (enabled == mSeekEnabled) return;
-
- mSeekEnabled = enabled;
- if (mTransientSeek.getVisibility() == VISIBLE && !enabled) {
- mTransientSeek.setVisibility(INVISIBLE);
- mMetadataContainer.setVisibility(VISIBLE);
- cancelResetToMetadata();
- }
- }
-
- public void setTransportControlCallback(KeyguardHostView.TransportControlCallback
- transportControlCallback) {
- mTransportControlCallback = transportControlCallback;
- }
-
- private void setEnableMarquee(boolean enabled) {
- if (DEBUG) Log.v(TAG, (enabled ? "Enable" : "Disable") + " transport text marquee");
- if (mTrackTitle != null) mTrackTitle.setSelected(enabled);
- if (mTrackArtistAlbum != null) mTrackTitle.setSelected(enabled);
- }
-
- @Override
- public void onFinishInflate() {
- super.onFinishInflate();
- mInfoContainer = (ViewGroup) findViewById(R.id.info_container);
- mMetadataContainer = (ViewGroup) findViewById(R.id.metadata_container);
- mBadge = (ImageView) findViewById(R.id.badge);
- mTrackTitle = (TextView) findViewById(R.id.title);
- mTrackArtistAlbum = (TextView) findViewById(R.id.artist_album);
- mTransientSeek = findViewById(R.id.transient_seek);
- mTransientSeekBar = (SeekBar) findViewById(R.id.transient_seek_bar);
- mTransientSeekBar.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
- mTransientSeekTimeElapsed = (TextView) findViewById(R.id.transient_seek_time_elapsed);
- mTransientSeekTimeTotal = (TextView) findViewById(R.id.transient_seek_time_remaining);
- mBtnPrev = (ImageView) findViewById(R.id.btn_prev);
- mBtnPlay = (ImageView) findViewById(R.id.btn_play);
- mBtnNext = (ImageView) findViewById(R.id.btn_next);
- final View buttons[] = { mBtnPrev, mBtnPlay, mBtnNext };
- for (View view : buttons) {
- view.setOnClickListener(mTransportCommandListener);
- view.setOnLongClickListener(mTransportShowSeekBarListener);
- }
- final boolean screenOn = KeyguardUpdateMonitor.getInstance(mContext).isScreenOn();
- setEnableMarquee(screenOn);
- // Allow long-press anywhere else in this view to show the seek bar
- setOnLongClickListener(mTransportShowSeekBarListener);
- }
-
- @Override
- public void onAttachedToWindow() {
- super.onAttachedToWindow();
- if (DEBUG) Log.v(TAG, "onAttachToWindow()");
- if (mPopulateMetadataWhenAttached != null) {
- updateMetadata(mPopulateMetadataWhenAttached);
- mPopulateMetadataWhenAttached = null;
- }
- if (DEBUG) Log.v(TAG, "Registering TCV " + this);
- mMetadata.clear();
- mAudioManager.registerRemoteController(mRemoteController);
- KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitor);
- }
-
- @Override
- protected void onConfigurationChanged(Configuration newConfig) {
- super.onConfigurationChanged(newConfig);
- final DisplayMetrics dm = getContext().getResources().getDisplayMetrics();
- final int dim = Math.max(dm.widthPixels, dm.heightPixels);
- mRemoteController.setArtworkConfiguration(true, dim, dim);
- }
-
- @Override
- public void onDetachedFromWindow() {
- if (DEBUG) Log.v(TAG, "onDetachFromWindow()");
- super.onDetachedFromWindow();
- if (DEBUG) Log.v(TAG, "Unregistering TCV " + this);
- mAudioManager.unregisterRemoteController(mRemoteController);
- KeyguardUpdateMonitor.getInstance(mContext).removeCallback(mUpdateMonitor);
- mMetadata.clear();
- removeCallbacks(mUpdateSeekBars);
- }
-
- @Override
- protected Parcelable onSaveInstanceState() {
- SavedState ss = new SavedState(super.onSaveInstanceState());
- ss.artist = mMetadata.artist;
- ss.trackTitle = mMetadata.trackTitle;
- ss.albumTitle = mMetadata.albumTitle;
- ss.duration = mMetadata.duration;
- ss.bitmap = mMetadata.bitmap;
- return ss;
- }
-
- @Override
- protected void onRestoreInstanceState(Parcelable state) {
- if (!(state instanceof SavedState)) {
- super.onRestoreInstanceState(state);
- return;
- }
- SavedState ss = (SavedState) state;
- super.onRestoreInstanceState(ss.getSuperState());
- mMetadata.artist = ss.artist;
- mMetadata.trackTitle = ss.trackTitle;
- mMetadata.albumTitle = ss.albumTitle;
- mMetadata.duration = ss.duration;
- mMetadata.bitmap = ss.bitmap;
- populateMetadata();
- }
-
- void setBadgeIcon(Drawable bmp) {
- mBadge.setImageDrawable(bmp);
-
- final ColorMatrix cm = new ColorMatrix();
- cm.setSaturation(0);
- mBadge.setColorFilter(new ColorMatrixColorFilter(cm));
- mBadge.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SCREEN));
- mBadge.setImageAlpha(0xef);
- }
-
- class Metadata {
- private String artist;
- private String trackTitle;
- private String albumTitle;
- private Bitmap bitmap;
- private long duration;
-
- public void clear() {
- artist = null;
- trackTitle = null;
- albumTitle = null;
- bitmap = null;
- duration = -1;
- }
-
- public String toString() {
- return "Metadata[artist=" + artist + " trackTitle=" + trackTitle +
- " albumTitle=" + albumTitle + " duration=" + duration + "]";
- }
- }
-
- void clearMetadata() {
- mPopulateMetadataWhenAttached = null;
- mMetadata.clear();
- populateMetadata();
- }
-
- void updateMetadata(RemoteController.MetadataEditor data) {
- if (isAttachedToWindow()) {
- mMetadata.artist = data.getString(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST,
- mMetadata.artist);
- mMetadata.trackTitle = data.getString(MediaMetadataRetriever.METADATA_KEY_TITLE,
- mMetadata.trackTitle);
- mMetadata.albumTitle = data.getString(MediaMetadataRetriever.METADATA_KEY_ALBUM,
- mMetadata.albumTitle);
- mMetadata.duration = data.getLong(MediaMetadataRetriever.METADATA_KEY_DURATION, -1);
- mMetadata.bitmap = data.getBitmap(MediaMetadataEditor.BITMAP_KEY_ARTWORK,
- mMetadata.bitmap);
- populateMetadata();
- } else {
- mPopulateMetadataWhenAttached = data;
- }
- }
-
- /**
- * Populates the given metadata into the view
- */
- private void populateMetadata() {
- if (ANIMATE_TRANSITIONS && isLaidOut() && mMetadataContainer.getVisibility() == VISIBLE) {
- TransitionManager.beginDelayedTransition(mMetadataContainer, mMetadataChangeTransition);
- }
-
- final String remoteClientPackage = mRemoteController.getRemoteControlClientPackageName();
- Drawable badgeIcon = null;
- try {
- badgeIcon = getContext().getPackageManager().getApplicationIcon(remoteClientPackage);
- } catch (PackageManager.NameNotFoundException e) {
- Log.e(TAG, "Couldn't get remote control client package icon", e);
- }
- setBadgeIcon(badgeIcon);
- mTrackTitle.setText(!TextUtils.isEmpty(mMetadata.trackTitle)
- ? mMetadata.trackTitle : null);
-
- final StringBuilder sb = new StringBuilder();
- if (!TextUtils.isEmpty(mMetadata.artist)) {
- if (sb.length() != 0) {
- sb.append(" - ");
- }
- sb.append(mMetadata.artist);
- }
- if (!TextUtils.isEmpty(mMetadata.albumTitle)) {
- if (sb.length() != 0) {
- sb.append(" - ");
- }
- sb.append(mMetadata.albumTitle);
- }
-
- final String trackArtistAlbum = sb.toString();
- mTrackArtistAlbum.setText(!TextUtils.isEmpty(trackArtistAlbum) ?
- trackArtistAlbum : null);
-
- if (mMetadata.duration >= 0) {
- setSeekBarsEnabled(true);
- setSeekBarDuration(mMetadata.duration);
-
- final String skeleton;
-
- if (mMetadata.duration >= 86400000) {
- skeleton = "DDD kk mm ss";
- } else if (mMetadata.duration >= 3600000) {
- skeleton = "kk mm ss";
- } else {
- skeleton = "mm ss";
- }
- mFormat = new SimpleDateFormat(DateFormat.getBestDateTimePattern(
- getContext().getResources().getConfiguration().locale,
- skeleton));
- mFormat.setTimeZone(TimeZone.getTimeZone("GMT+0"));
- } else {
- setSeekBarsEnabled(false);
- }
-
- KeyguardUpdateMonitor.getInstance(getContext()).dispatchSetBackground(mMetadata.bitmap);
- final int flags = mTransportControlFlags;
- setVisibilityBasedOnFlag(mBtnPrev, flags, RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS);
- setVisibilityBasedOnFlag(mBtnNext, flags, RemoteControlClient.FLAG_KEY_MEDIA_NEXT);
- setVisibilityBasedOnFlag(mBtnPlay, flags,
- RemoteControlClient.FLAG_KEY_MEDIA_PLAY
- | RemoteControlClient.FLAG_KEY_MEDIA_PAUSE
- | RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE
- | RemoteControlClient.FLAG_KEY_MEDIA_STOP);
-
- updatePlayPauseState(mCurrentPlayState);
- }
-
- void updateSeekDisplay() {
- if (mMetadata != null && mRemoteController != null && mFormat != null) {
- mTempDate.setTime(mRemoteController.getEstimatedMediaPosition());
- mTransientSeekTimeElapsed.setText(mFormat.format(mTempDate));
- mTempDate.setTime(mMetadata.duration);
- mTransientSeekTimeTotal.setText(mFormat.format(mTempDate));
-
- if (DEBUG) Log.d(TAG, "updateSeekDisplay timeElapsed=" + mTempDate +
- " duration=" + mMetadata.duration);
- }
- }
-
- boolean tryToggleSeekBar() {
- if (ANIMATE_TRANSITIONS) {
- TransitionManager.beginDelayedTransition(mInfoContainer);
- }
- if (mTransientSeek.getVisibility() == VISIBLE) {
- mTransientSeek.setVisibility(INVISIBLE);
- mMetadataContainer.setVisibility(VISIBLE);
- cancelResetToMetadata();
- removeCallbacks(mUpdateSeekBars); // don't update if scrubber isn't visible
- } else {
- mTransientSeek.setVisibility(VISIBLE);
- mMetadataContainer.setVisibility(INVISIBLE);
- delayResetToMetadata();
- if (playbackPositionShouldMove(mCurrentPlayState)) {
- mUpdateSeekBars.run();
- } else {
- mUpdateSeekBars.updateOnce();
- }
- }
- mTransportControlCallback.userActivity();
- return true;
- }
-
- void resetToMetadata() {
- if (ANIMATE_TRANSITIONS) {
- TransitionManager.beginDelayedTransition(mInfoContainer);
- }
- if (mTransientSeek.getVisibility() == VISIBLE) {
- mTransientSeek.setVisibility(INVISIBLE);
- mMetadataContainer.setVisibility(VISIBLE);
- }
- // TODO Also hide ratings, if applicable
- }
-
- void delayResetToMetadata() {
- removeCallbacks(mResetToMetadata);
- postDelayed(mResetToMetadata, RESET_TO_METADATA_DELAY);
- }
-
- void cancelResetToMetadata() {
- removeCallbacks(mResetToMetadata);
- }
-
- void setSeekBarDuration(long duration) {
- mTransientSeekBar.setMax((int) duration);
- }
-
- void scrubTo(int progress) {
- mRemoteController.seekTo(progress);
- mTransportControlCallback.userActivity();
- }
-
- private static void setVisibilityBasedOnFlag(View view, int flags, int flag) {
- if ((flags & flag) != 0) {
- view.setVisibility(View.VISIBLE);
- } else {
- view.setVisibility(View.INVISIBLE);
- }
- }
-
- private void updatePlayPauseState(int state) {
- if (DEBUG) Log.v(TAG,
- "updatePlayPauseState(), old=" + mCurrentPlayState + ", state=" + state);
- if (state == mCurrentPlayState) {
- return;
- }
- final int imageResId;
- final int imageDescId;
- switch (state) {
- case RemoteControlClient.PLAYSTATE_ERROR:
- imageResId = R.drawable.stat_sys_warning;
- // TODO use more specific image description string for warning, but here the "play"
- // message is still valid because this button triggers a play command.
- imageDescId = R.string.keyguard_transport_play_description;
- break;
-
- case RemoteControlClient.PLAYSTATE_PLAYING:
- imageResId = R.drawable.ic_media_pause;
- imageDescId = R.string.keyguard_transport_pause_description;
- break;
-
- case RemoteControlClient.PLAYSTATE_BUFFERING:
- imageResId = R.drawable.ic_media_stop;
- imageDescId = R.string.keyguard_transport_stop_description;
- break;
-
- case RemoteControlClient.PLAYSTATE_PAUSED:
- default:
- imageResId = R.drawable.ic_media_play;
- imageDescId = R.string.keyguard_transport_play_description;
- break;
- }
-
- boolean clientSupportsSeek = mMetadata != null && mMetadata.duration > 0;
- setSeekBarsEnabled(clientSupportsSeek);
-
- mBtnPlay.setImageResource(imageResId);
- mBtnPlay.setContentDescription(getResources().getString(imageDescId));
- mCurrentPlayState = state;
- }
-
- boolean updateSeekBars() {
- final int position = (int) mRemoteController.getEstimatedMediaPosition();
- if (DEBUG) Log.v(TAG, "Estimated time:" + position);
- if (position >= 0) {
- mTransientSeekBar.setProgress(position);
- return true;
- }
- Log.w(TAG, "Updating seek bars; received invalid estimated media position (" +
- position + "). Disabling seek.");
- setSeekBarsEnabled(false);
- return false;
- }
-
- static class SavedState extends BaseSavedState {
- boolean clientPresent;
- String artist;
- String trackTitle;
- String albumTitle;
- long duration;
- Bitmap bitmap;
-
- SavedState(Parcelable superState) {
- super(superState);
- }
-
- private SavedState(Parcel in) {
- super(in);
- clientPresent = in.readInt() != 0;
- artist = in.readString();
- trackTitle = in.readString();
- albumTitle = in.readString();
- duration = in.readLong();
- bitmap = Bitmap.CREATOR.createFromParcel(in);
- }
-
- @Override
- public void writeToParcel(Parcel out, int flags) {
- super.writeToParcel(out, flags);
- out.writeInt(clientPresent ? 1 : 0);
- out.writeString(artist);
- out.writeString(trackTitle);
- out.writeString(albumTitle);
- out.writeLong(duration);
- bitmap.writeToParcel(out, flags);
- }
-
- public static final Parcelable.Creator<SavedState> CREATOR
- = new Parcelable.Creator<SavedState>() {
- public SavedState createFromParcel(Parcel in) {
- return new SavedState(in);
- }
-
- public SavedState[] newArray(int size) {
- return new SavedState[size];
- }
- };
- }
-
- private void sendMediaButtonClick(int keyCode) {
- // TODO We should think about sending these up/down events accurately with touch up/down
- // on the buttons, but in the near term this will interfere with the long press behavior.
- mRemoteController.sendMediaKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, keyCode));
- mRemoteController.sendMediaKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, keyCode));
-
- mTransportControlCallback.userActivity();
- }
-
- public boolean providesClock() {
- return false;
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
index c8cfe31..ef1fb5e 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -1251,7 +1251,7 @@
} catch(IllegalArgumentException ex) {
Log.w(TAG, "Unknown sim state: " + simState);
state = State.UNKNOWN;
- }
+ }
mSimDatas.put(subId, new SimData(state, slotId, subId));
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java b/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java
deleted file mode 100644
index e1e1cfc..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java
+++ /dev/null
@@ -1,485 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import android.app.Activity;
-import android.app.ActivityManager;
-import android.app.ActivityOptions;
-import android.app.SearchManager;
-import android.content.Context;
-import android.content.Intent;
-import android.content.res.Resources;
-import android.graphics.Canvas;
-import android.media.AudioManager;
-import android.media.IAudioService;
-import android.os.Bundle;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.os.SystemClock;
-import android.os.UserHandle;
-import android.telephony.TelephonyManager;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.util.Slog;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-import android.view.View;
-import android.widget.FrameLayout;
-
-import com.android.internal.widget.LockPatternUtils;
-import com.android.keyguard.KeyguardHostView.OnDismissAction;
-import com.android.keyguard.KeyguardSecurityContainer.SecurityCallback;
-import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
-
-import java.io.File;
-
-/**
- * Base class for keyguard view. {@link #reset} is where you should
- * reset the state of your view. Use the {@link KeyguardViewCallback} via
- * {@link #getCallback()} to send information back (such as poking the wake lock,
- * or finishing the keyguard).
- *
- * Handles intercepting of media keys that still work when the keyguard is
- * showing.
- */
-public abstract class KeyguardViewBase extends FrameLayout implements SecurityCallback {
-
- private AudioManager mAudioManager;
- private TelephonyManager mTelephonyManager = null;
- protected ViewMediatorCallback mViewMediatorCallback;
- protected LockPatternUtils mLockPatternUtils;
- private OnDismissAction mDismissAction;
-
- // Whether the volume keys should be handled by keyguard. If true, then
- // they will be handled here for specific media types such as music, otherwise
- // the audio service will bring up the volume dialog.
- private static final boolean KEYGUARD_MANAGES_VOLUME = false;
- public static final boolean DEBUG = KeyguardConstants.DEBUG;
- private static final String TAG = "KeyguardViewBase";
-
- private KeyguardSecurityContainer mSecurityContainer;
-
- public KeyguardViewBase(Context context) {
- this(context, null);
- }
-
- public KeyguardViewBase(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- @Override
- protected void dispatchDraw(Canvas canvas) {
- super.dispatchDraw(canvas);
- if (mViewMediatorCallback != null) {
- mViewMediatorCallback.keyguardDoneDrawing();
- }
- }
-
- /**
- * Sets an action to run when keyguard finishes.
- *
- * @param action
- */
- public void setOnDismissAction(OnDismissAction action) {
- mDismissAction = action;
- }
-
- @Override
- protected void onFinishInflate() {
- mSecurityContainer =
- (KeyguardSecurityContainer) findViewById(R.id.keyguard_security_container);
- mLockPatternUtils = new LockPatternUtils(mContext);
- mSecurityContainer.setLockPatternUtils(mLockPatternUtils);
- mSecurityContainer.setSecurityCallback(this);
- mSecurityContainer.showPrimarySecurityScreen(false);
- // mSecurityContainer.updateSecurityViews(false /* not bouncing */);
- }
-
- /**
- * Called when the view needs to be shown.
- */
- public void showPrimarySecurityScreen() {
- if (DEBUG) Log.d(TAG, "show()");
- mSecurityContainer.showPrimarySecurityScreen(false);
- }
-
- /**
- * Dismisses the keyguard by going to the next screen or making it gone.
- *
- * @return True if the keyguard is done.
- */
- public boolean dismiss() {
- return dismiss(false);
- }
-
- protected void showBouncer(boolean show) {
- CharSequence what = getContext().getResources().getText(
- show ? R.string.keyguard_accessibility_show_bouncer
- : R.string.keyguard_accessibility_hide_bouncer);
- announceForAccessibility(what);
- announceCurrentSecurityMethod();
- }
-
- public boolean handleBackKey() {
- if (mSecurityContainer.getCurrentSecuritySelection() == SecurityMode.Account) {
- // go back to primary screen
- mSecurityContainer.showPrimarySecurityScreen(false /*turningOff*/);
- return true;
- }
- if (mSecurityContainer.getCurrentSecuritySelection() != SecurityMode.None) {
- mSecurityContainer.dismiss(false);
- return true;
- }
- return false;
- }
-
- protected void announceCurrentSecurityMethod() {
- mSecurityContainer.announceCurrentSecurityMethod();
- }
-
- protected KeyguardSecurityContainer getSecurityContainer() {
- return mSecurityContainer;
- }
-
- @Override
- public boolean dismiss(boolean authenticated) {
- return mSecurityContainer.showNextSecurityScreenOrFinish(authenticated);
- }
-
- /**
- * Authentication has happened and it's time to dismiss keyguard. This function
- * should clean up and inform KeyguardViewMediator.
- */
- @Override
- public void finish() {
- // If the alternate unlock was suppressed, it can now be safely
- // enabled because the user has left keyguard.
- KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(true);
-
- // If there's a pending runnable because the user interacted with a widget
- // and we're leaving keyguard, then run it.
- boolean deferKeyguardDone = false;
- if (mDismissAction != null) {
- deferKeyguardDone = mDismissAction.onDismiss();
- mDismissAction = null;
- }
- if (mViewMediatorCallback != null) {
- if (deferKeyguardDone) {
- mViewMediatorCallback.keyguardDonePending();
- } else {
- mViewMediatorCallback.keyguardDone(true);
- }
- }
- }
-
- @Override
- public void onSecurityModeChanged(SecurityMode securityMode, boolean needsInput) {
- if (mViewMediatorCallback != null) {
- mViewMediatorCallback.setNeedsInput(needsInput);
- }
- }
-
- public void userActivity() {
- if (mViewMediatorCallback != null) {
- mViewMediatorCallback.userActivity();
- }
- }
-
- protected void onUserActivityTimeoutChanged() {
- if (mViewMediatorCallback != null) {
- mViewMediatorCallback.onUserActivityTimeoutChanged();
- }
- }
-
- /**
- * Called when the Keyguard is not actively shown anymore on the screen.
- */
- public void onPause() {
- if (DEBUG) Log.d(TAG, String.format("screen off, instance %s at %s",
- Integer.toHexString(hashCode()), SystemClock.uptimeMillis()));
- // Once the screen turns off, we no longer consider this to be first boot and we want the
- // biometric unlock to start next time keyguard is shown.
- KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(true);
- mSecurityContainer.showPrimarySecurityScreen(true);
- mSecurityContainer.onPause();
- clearFocus();
- }
-
- /**
- * Called when the Keyguard is actively shown on the screen.
- */
- public void onResume() {
- if (DEBUG) Log.d(TAG, "screen on, instance " + Integer.toHexString(hashCode()));
- mSecurityContainer.onResume(KeyguardSecurityView.SCREEN_ON);
- requestFocus();
- }
-
- /**
- * Starts the animation when the Keyguard gets shown.
- */
- public void startAppearAnimation() {
- mSecurityContainer.startAppearAnimation();
- }
-
- public void startDisappearAnimation(Runnable finishRunnable) {
- if (!mSecurityContainer.startDisappearAnimation(finishRunnable) && finishRunnable != null) {
- finishRunnable.run();
- }
- }
-
- /**
- * Verify that the user can get past the keyguard securely. This is called,
- * for example, when the phone disables the keyguard but then wants to launch
- * something else that requires secure access.
- *
- * The result will be propogated back via {@link KeyguardViewCallback#keyguardDone(boolean)}
- */
- public void verifyUnlock() {
- SecurityMode securityMode = mSecurityContainer.getSecurityMode();
- if (securityMode == KeyguardSecurityModel.SecurityMode.None) {
- if (mViewMediatorCallback != null) {
- mViewMediatorCallback.keyguardDone(true);
- }
- } else if (securityMode != KeyguardSecurityModel.SecurityMode.Pattern
- && securityMode != KeyguardSecurityModel.SecurityMode.PIN
- && securityMode != KeyguardSecurityModel.SecurityMode.Password) {
- // can only verify unlock when in pattern/password mode
- if (mViewMediatorCallback != null) {
- mViewMediatorCallback.keyguardDone(false);
- }
- } else {
- // otherwise, go to the unlock screen, see if they can verify it
- mSecurityContainer.verifyUnlock();
- }
- }
-
- /**
- * Called before this view is being removed.
- */
- abstract public void cleanUp();
-
- /**
- * Gets the desired user activity timeout in milliseconds, or -1 if the
- * default should be used.
- */
- abstract public long getUserActivityTimeout();
-
- @Override
- public boolean dispatchKeyEvent(KeyEvent event) {
- if (interceptMediaKey(event)) {
- return true;
- }
- return super.dispatchKeyEvent(event);
- }
-
- /**
- * Allows the media keys to work when the keyguard is showing.
- * The media keys should be of no interest to the actual keyguard view(s),
- * so intercepting them here should not be of any harm.
- * @param event The key event
- * @return whether the event was consumed as a media key.
- */
- public boolean interceptMediaKey(KeyEvent event) {
- final int keyCode = event.getKeyCode();
- if (event.getAction() == KeyEvent.ACTION_DOWN) {
- switch (keyCode) {
- case KeyEvent.KEYCODE_MEDIA_PLAY:
- case KeyEvent.KEYCODE_MEDIA_PAUSE:
- case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
- /* Suppress PLAY/PAUSE toggle when phone is ringing or
- * in-call to avoid music playback */
- if (mTelephonyManager == null) {
- mTelephonyManager = (TelephonyManager) getContext().getSystemService(
- Context.TELEPHONY_SERVICE);
- }
- if (mTelephonyManager != null &&
- mTelephonyManager.getCallState() != TelephonyManager.CALL_STATE_IDLE) {
- return true; // suppress key event
- }
- case KeyEvent.KEYCODE_MUTE:
- case KeyEvent.KEYCODE_HEADSETHOOK:
- case KeyEvent.KEYCODE_MEDIA_STOP:
- case KeyEvent.KEYCODE_MEDIA_NEXT:
- case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
- case KeyEvent.KEYCODE_MEDIA_REWIND:
- case KeyEvent.KEYCODE_MEDIA_RECORD:
- case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
- case KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK: {
- handleMediaKeyEvent(event);
- return true;
- }
-
- case KeyEvent.KEYCODE_VOLUME_UP:
- case KeyEvent.KEYCODE_VOLUME_DOWN:
- case KeyEvent.KEYCODE_VOLUME_MUTE: {
- if (KEYGUARD_MANAGES_VOLUME) {
- synchronized (this) {
- if (mAudioManager == null) {
- mAudioManager = (AudioManager) getContext().getSystemService(
- Context.AUDIO_SERVICE);
- }
- }
- // Volume buttons should only function for music (local or remote).
- // TODO: Actually handle MUTE.
- mAudioManager.adjustSuggestedStreamVolume(
- keyCode == KeyEvent.KEYCODE_VOLUME_UP
- ? AudioManager.ADJUST_RAISE
- : AudioManager.ADJUST_LOWER /* direction */,
- AudioManager.STREAM_MUSIC /* stream */, 0 /* flags */);
- // Don't execute default volume behavior
- return true;
- } else {
- return false;
- }
- }
- }
- } else if (event.getAction() == KeyEvent.ACTION_UP) {
- switch (keyCode) {
- case KeyEvent.KEYCODE_MUTE:
- case KeyEvent.KEYCODE_HEADSETHOOK:
- case KeyEvent.KEYCODE_MEDIA_PLAY:
- case KeyEvent.KEYCODE_MEDIA_PAUSE:
- case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
- case KeyEvent.KEYCODE_MEDIA_STOP:
- case KeyEvent.KEYCODE_MEDIA_NEXT:
- case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
- case KeyEvent.KEYCODE_MEDIA_REWIND:
- case KeyEvent.KEYCODE_MEDIA_RECORD:
- case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
- case KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK: {
- handleMediaKeyEvent(event);
- return true;
- }
- }
- }
- return false;
- }
-
- private void handleMediaKeyEvent(KeyEvent keyEvent) {
- synchronized (this) {
- if (mAudioManager == null) {
- mAudioManager = (AudioManager) getContext().getSystemService(
- Context.AUDIO_SERVICE);
- }
- }
- mAudioManager.dispatchMediaKeyEvent(keyEvent);
- }
-
- @Override
- public void dispatchSystemUiVisibilityChanged(int visibility) {
- super.dispatchSystemUiVisibilityChanged(visibility);
-
- if (!(mContext instanceof Activity)) {
- setSystemUiVisibility(STATUS_BAR_DISABLE_BACK);
- }
- }
-
- /**
- * In general, we enable unlocking the insecure keyguard with the menu key. However, there are
- * some cases where we wish to disable it, notably when the menu button placement or technology
- * is prone to false positives.
- *
- * @return true if the menu key should be enabled
- */
- private static final String ENABLE_MENU_KEY_FILE = "/data/local/enable_menu_key";
- private boolean shouldEnableMenuKey() {
- final Resources res = getResources();
- final boolean configDisabled = res.getBoolean(R.bool.config_disableMenuKeyInLockScreen);
- final boolean isTestHarness = ActivityManager.isRunningInTestHarness();
- final boolean fileOverride = (new File(ENABLE_MENU_KEY_FILE)).exists();
- return !configDisabled || isTestHarness || fileOverride;
- }
-
- public boolean handleMenuKey() {
- // The following enables the MENU key to work for testing automation
- if (shouldEnableMenuKey()) {
- dismiss();
- return true;
- }
- return false;
- }
-
- public void setViewMediatorCallback(ViewMediatorCallback viewMediatorCallback) {
- mViewMediatorCallback = viewMediatorCallback;
- // Update ViewMediator with the current input method requirements
- mViewMediatorCallback.setNeedsInput(mSecurityContainer.needsInput());
- }
-
- protected KeyguardActivityLauncher getActivityLauncher() {
- return mActivityLauncher;
- }
-
- private final KeyguardActivityLauncher mActivityLauncher = new KeyguardActivityLauncher() {
- @Override
- Context getContext() {
- return mContext;
- }
-
- @Override
- void setOnDismissAction(OnDismissAction action) {
- KeyguardViewBase.this.setOnDismissAction(action);
- }
-
- @Override
- LockPatternUtils getLockPatternUtils() {
- return mLockPatternUtils;
- }
-
- @Override
- void requestDismissKeyguard() {
- KeyguardViewBase.this.dismiss(false);
- }
- };
-
- public void showAssistant() {
- final Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
- .getAssistIntent(mContext, true, UserHandle.USER_CURRENT);
-
- if (intent == null) return;
-
- final ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext,
- R.anim.keyguard_action_assist_enter, R.anim.keyguard_action_assist_exit,
- getHandler(), null);
-
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- mActivityLauncher.launchActivityWithAnimation(intent, false, opts.toBundle(), null, null);
- }
-
- public void launchCamera() {
- mActivityLauncher.launchCamera(getHandler(), null);
- }
-
- public void setLockPatternUtils(LockPatternUtils utils) {
- mLockPatternUtils = utils;
- mSecurityContainer.setLockPatternUtils(utils);
- }
-
- public SecurityMode getSecurityMode() {
- return mSecurityContainer.getSecurityMode();
- }
-
- public SecurityMode getCurrentSecurityMode() {
- return mSecurityContainer.getCurrentSecurityMode();
- }
-
- protected abstract void onUserSwitching(boolean switching);
-
- protected abstract void onCreateOptions(Bundle options);
-
- protected abstract void onExternalMotionEvent(MotionEvent event);
-
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardViewStateManager.java b/packages/Keyguard/src/com/android/keyguard/KeyguardViewStateManager.java
deleted file mode 100644
index e47edf3..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardViewStateManager.java
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.keyguard;
-
-import android.animation.Animator;
-import android.animation.Animator.AnimatorListener;
-import android.animation.AnimatorListenerAdapter;
-import android.os.Handler;
-import android.os.Looper;
-import android.view.View;
-
-public class KeyguardViewStateManager implements
- SlidingChallengeLayout.OnChallengeScrolledListener,
- ChallengeLayout.OnBouncerStateChangedListener {
-
- private static final String TAG = "KeyguardViewStateManager";
- private KeyguardWidgetPager mKeyguardWidgetPager;
- private ChallengeLayout mChallengeLayout;
- private KeyguardHostView mKeyguardHostView;
- private int[] mTmpPoint = new int[2];
- private int[] mTmpLoc = new int[2];
-
- private KeyguardSecurityView mKeyguardSecurityContainer;
- private static final int SCREEN_ON_HINT_DURATION = 1000;
- private static final int SCREEN_ON_RING_HINT_DELAY = 300;
- private static final boolean SHOW_INITIAL_PAGE_HINTS = false;
- Handler mMainQueue = new Handler(Looper.myLooper());
-
- int mLastScrollState = SlidingChallengeLayout.SCROLL_STATE_IDLE;
-
- // Paged view state
- private int mPageListeningToSlider = -1;
- private int mCurrentPage = -1;
- private int mPageIndexOnPageBeginMoving = -1;
-
- int mChallengeTop = 0;
-
- private final AnimatorListener mPauseListener = new AnimatorListenerAdapter() {
- public void onAnimationEnd(Animator animation) {
- mKeyguardSecurityContainer.onPause();
- }
- };
-
- private final AnimatorListener mResumeListener = new AnimatorListenerAdapter() {
- public void onAnimationEnd(Animator animation) {
- if (((View)mKeyguardSecurityContainer).isShown()) {
- mKeyguardSecurityContainer.onResume(0);
- }
- }
- };
-
- public KeyguardViewStateManager(KeyguardHostView hostView) {
- mKeyguardHostView = hostView;
- }
-
- public void setPagedView(KeyguardWidgetPager pagedView) {
- mKeyguardWidgetPager = pagedView;
- updateEdgeSwiping();
- }
-
- public void setChallengeLayout(ChallengeLayout layout) {
- mChallengeLayout = layout;
- updateEdgeSwiping();
- }
-
- private void updateEdgeSwiping() {
- if (mChallengeLayout != null && mKeyguardWidgetPager != null) {
- if (mChallengeLayout.isChallengeOverlapping()) {
- mKeyguardWidgetPager.setOnlyAllowEdgeSwipes(true);
- } else {
- mKeyguardWidgetPager.setOnlyAllowEdgeSwipes(false);
- }
- }
- }
-
- public boolean isChallengeShowing() {
- if (mChallengeLayout != null) {
- return mChallengeLayout.isChallengeShowing();
- }
- return false;
- }
-
- public boolean isChallengeOverlapping() {
- if (mChallengeLayout != null) {
- return mChallengeLayout.isChallengeOverlapping();
- }
- return false;
- }
-
- public void setSecurityViewContainer(KeyguardSecurityView container) {
- mKeyguardSecurityContainer = container;
- }
-
- public void showBouncer(boolean show) {
- mChallengeLayout.showBouncer();
- }
-
- public boolean isBouncing() {
- return mChallengeLayout.isBouncing();
- }
-
- public void fadeOutSecurity(int duration) {
- ((View) mKeyguardSecurityContainer).animate().alpha(0f).setDuration(duration)
- .setListener(mPauseListener);
- }
-
- public void fadeInSecurity(int duration) {
- ((View) mKeyguardSecurityContainer).animate().alpha(1f).setDuration(duration)
- .setListener(mResumeListener);
- }
-
- public void onPageBeginMoving() {
- if (mChallengeLayout.isChallengeOverlapping() &&
- mChallengeLayout instanceof SlidingChallengeLayout) {
- SlidingChallengeLayout scl = (SlidingChallengeLayout) mChallengeLayout;
- scl.fadeOutChallenge();
- mPageIndexOnPageBeginMoving = mKeyguardWidgetPager.getCurrentPage();
- }
- // We use mAppWidgetToShow to show a particular widget after you add it--
- // once the user swipes a page we clear that behavior
- if (mKeyguardHostView != null) {
- mKeyguardHostView.clearAppWidgetToShow();
- mKeyguardHostView.setOnDismissAction(null);
- }
- if (mHideHintsRunnable != null) {
- mMainQueue.removeCallbacks(mHideHintsRunnable);
- mHideHintsRunnable = null;
- }
- }
-
- public void onPageEndMoving() {
- mPageIndexOnPageBeginMoving = -1;
- }
-
- public void onPageSwitching(View newPage, int newPageIndex) {
- if (mKeyguardWidgetPager != null && mChallengeLayout instanceof SlidingChallengeLayout) {
- boolean isCameraPage = newPage instanceof CameraWidgetFrame;
- if (isCameraPage) {
- CameraWidgetFrame camera = (CameraWidgetFrame) newPage;
- camera.setUseFastTransition(mKeyguardWidgetPager.isWarping());
- }
- SlidingChallengeLayout scl = (SlidingChallengeLayout) mChallengeLayout;
- scl.setChallengeInteractive(!isCameraPage);
- final int currentFlags = mKeyguardWidgetPager.getSystemUiVisibility();
- final int newFlags = isCameraPage ? (currentFlags | View.STATUS_BAR_DISABLE_SEARCH)
- : (currentFlags & ~View.STATUS_BAR_DISABLE_SEARCH);
- mKeyguardWidgetPager.setSystemUiVisibility(newFlags);
- }
-
- // If the page we're settling to is the same as we started on, and the action of
- // moving the page hid the security, we restore it immediately.
- if (mPageIndexOnPageBeginMoving == mKeyguardWidgetPager.getNextPage() &&
- mChallengeLayout instanceof SlidingChallengeLayout) {
- SlidingChallengeLayout scl = (SlidingChallengeLayout) mChallengeLayout;
- scl.fadeInChallenge();
- mKeyguardWidgetPager.setWidgetToResetOnPageFadeOut(-1);
- }
- mPageIndexOnPageBeginMoving = -1;
- }
-
- public void onPageSwitched(View newPage, int newPageIndex) {
- // Reset the previous page size and ensure the current page is sized appropriately.
- // We only modify the page state if it is not currently under control by the slider.
- // This prevents conflicts.
-
- // If the page hasn't switched, don't bother with any of this
- if (mCurrentPage == newPageIndex) return;
-
- if (mKeyguardWidgetPager != null && mChallengeLayout != null) {
- KeyguardWidgetFrame prevPage = mKeyguardWidgetPager.getWidgetPageAt(mCurrentPage);
- if (prevPage != null && mCurrentPage != mPageListeningToSlider && mCurrentPage
- != mKeyguardWidgetPager.getWidgetToResetOnPageFadeOut()) {
- prevPage.resetSize();
- }
-
- KeyguardWidgetFrame newCurPage = mKeyguardWidgetPager.getWidgetPageAt(newPageIndex);
- boolean challengeOverlapping = mChallengeLayout.isChallengeOverlapping();
- if (challengeOverlapping && !newCurPage.isSmall()
- && mPageListeningToSlider != newPageIndex) {
- newCurPage.shrinkWidget(true);
- }
- }
-
- mCurrentPage = newPageIndex;
- }
-
- public void onPageBeginWarp() {
- fadeOutSecurity(SlidingChallengeLayout.CHALLENGE_FADE_OUT_DURATION);
- View frame = mKeyguardWidgetPager.getPageAt(mKeyguardWidgetPager.getPageWarpIndex());
- ((KeyguardWidgetFrame)frame).showFrame(this);
- }
-
- public void onPageEndWarp() {
- fadeInSecurity(SlidingChallengeLayout.CHALLENGE_FADE_IN_DURATION);
- View frame = mKeyguardWidgetPager.getPageAt(mKeyguardWidgetPager.getPageWarpIndex());
- ((KeyguardWidgetFrame)frame).hideFrame(this);
- }
-
- private int getChallengeTopRelativeToFrame(KeyguardWidgetFrame frame, int top) {
- mTmpPoint[0] = 0;
- mTmpPoint[1] = top;
- mapPoint((View) mChallengeLayout, frame, mTmpPoint);
- return mTmpPoint[1];
- }
-
- /**
- * Simple method to map a point from one view's coordinates to another's. Note: this method
- * doesn't account for transforms, so if the views will be transformed, this should not be used.
- *
- * @param fromView The view to which the point is relative
- * @param toView The view into which the point should be mapped
- * @param pt The point
- */
- private void mapPoint(View fromView, View toView, int pt[]) {
- fromView.getLocationInWindow(mTmpLoc);
-
- int x = mTmpLoc[0];
- int y = mTmpLoc[1];
-
- toView.getLocationInWindow(mTmpLoc);
- int vX = mTmpLoc[0];
- int vY = mTmpLoc[1];
-
- pt[0] += x - vX;
- pt[1] += y - vY;
- }
-
- private void userActivity() {
- if (mKeyguardHostView != null) {
- mKeyguardHostView.onUserActivityTimeoutChanged();
- mKeyguardHostView.userActivity();
- }
- }
-
- @Override
- public void onScrollStateChanged(int scrollState) {
- if (mKeyguardWidgetPager == null || mChallengeLayout == null) return;
-
- boolean challengeOverlapping = mChallengeLayout.isChallengeOverlapping();
-
- if (scrollState == SlidingChallengeLayout.SCROLL_STATE_IDLE) {
- KeyguardWidgetFrame frame = mKeyguardWidgetPager.getWidgetPageAt(mPageListeningToSlider);
- if (frame == null) return;
-
- if (!challengeOverlapping) {
- if (!mKeyguardWidgetPager.isPageMoving()) {
- frame.resetSize();
- userActivity();
- } else {
- mKeyguardWidgetPager.setWidgetToResetOnPageFadeOut(mPageListeningToSlider);
- }
- }
- if (frame.isSmall()) {
- // This is to make sure that if the scroller animation gets cut off midway
- // that the frame doesn't stay in a partial down position.
- frame.setFrameHeight(frame.getSmallFrameHeight());
- }
- if (scrollState != SlidingChallengeLayout.SCROLL_STATE_FADING) {
- frame.hideFrame(this);
- }
- updateEdgeSwiping();
-
- if (mChallengeLayout.isChallengeShowing()) {
- mKeyguardSecurityContainer.onResume(KeyguardSecurityView.VIEW_REVEALED);
- } else {
- mKeyguardSecurityContainer.onPause();
- }
- mPageListeningToSlider = -1;
- } else if (mLastScrollState == SlidingChallengeLayout.SCROLL_STATE_IDLE) {
- // Whether dragging or settling, if the last state was idle, we use this signal
- // to update the current page who will receive events from the sliding challenge.
- // We resize the frame as appropriate.
- mPageListeningToSlider = mKeyguardWidgetPager.getNextPage();
- KeyguardWidgetFrame frame = mKeyguardWidgetPager.getWidgetPageAt(mPageListeningToSlider);
- if (frame == null) return;
-
- // Skip showing the frame and shrinking the widget if we are
- if (!mChallengeLayout.isBouncing()) {
- if (scrollState != SlidingChallengeLayout.SCROLL_STATE_FADING) {
- frame.showFrame(this);
- }
-
- // As soon as the security begins sliding, the widget becomes small (if it wasn't
- // small to begin with).
- if (!frame.isSmall()) {
- // We need to fetch the final page, in case the pages are in motion.
- mPageListeningToSlider = mKeyguardWidgetPager.getNextPage();
- frame.shrinkWidget(false);
- }
- } else {
- if (!frame.isSmall()) {
- // We need to fetch the final page, in case the pages are in motion.
- mPageListeningToSlider = mKeyguardWidgetPager.getNextPage();
- }
- }
-
- // View is on the move. Pause the security view until it completes.
- mKeyguardSecurityContainer.onPause();
- }
- mLastScrollState = scrollState;
- }
-
- @Override
- public void onScrollPositionChanged(float scrollPosition, int challengeTop) {
- mChallengeTop = challengeTop;
- KeyguardWidgetFrame frame = mKeyguardWidgetPager.getWidgetPageAt(mPageListeningToSlider);
- if (frame != null && mLastScrollState != SlidingChallengeLayout.SCROLL_STATE_FADING) {
- frame.adjustFrame(getChallengeTopRelativeToFrame(frame, mChallengeTop));
- }
- }
-
- private Runnable mHideHintsRunnable = new Runnable() {
- @Override
- public void run() {
- if (mKeyguardWidgetPager != null) {
- mKeyguardWidgetPager.hideOutlinesAndSidePages();
- }
- }
- };
-
- public void showUsabilityHints() {
- mMainQueue.postDelayed( new Runnable() {
- @Override
- public void run() {
- mKeyguardSecurityContainer.showUsabilityHint();
- }
- } , SCREEN_ON_RING_HINT_DELAY);
- if (SHOW_INITIAL_PAGE_HINTS) {
- mKeyguardWidgetPager.showInitialPageHints();
- }
- if (mHideHintsRunnable != null) {
- mMainQueue.postDelayed(mHideHintsRunnable, SCREEN_ON_HINT_DURATION);
- }
- }
-
- // ChallengeLayout.OnBouncerStateChangedListener
- @Override
- public void onBouncerStateChanged(boolean bouncerActive) {
- if (bouncerActive) {
- mKeyguardWidgetPager.zoomOutToBouncer();
- } else {
- mKeyguardWidgetPager.zoomInFromBouncer();
- if (mKeyguardHostView != null) {
- mKeyguardHostView.setOnDismissAction(null);
- }
- }
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetCarousel.java b/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetCarousel.java
deleted file mode 100644
index 98b31b7..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetCarousel.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.keyguard;
-
-import android.animation.Animator;
-import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
-import android.animation.PropertyValuesHolder;
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.View;
-import android.view.animation.AccelerateInterpolator;
-import android.view.animation.DecelerateInterpolator;
-import android.view.animation.Interpolator;
-
-import java.util.ArrayList;
-
-public class KeyguardWidgetCarousel extends KeyguardWidgetPager {
-
- private float mAdjacentPagesAngle;
- private static float MAX_SCROLL_PROGRESS = 1.3f;
- private static float CAMERA_DISTANCE = 10000;
- protected AnimatorSet mChildrenTransformsAnimator;
- float[] mTmpTransform = new float[3];
-
- public KeyguardWidgetCarousel(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public KeyguardWidgetCarousel(Context context) {
- this(context, null, 0);
- }
-
- public KeyguardWidgetCarousel(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- mAdjacentPagesAngle = context.getResources().getInteger(R.integer.kg_carousel_angle);
- }
-
- protected float getMaxScrollProgress() {
- return MAX_SCROLL_PROGRESS;
- }
-
- public float getAlphaForPage(int screenCenter, int index, boolean showSidePages) {
- View child = getChildAt(index);
- if (child == null) return 0f;
-
- boolean inVisibleRange = index >= getNextPage() - 1 && index <= getNextPage() + 1;
- float scrollProgress = getScrollProgress(screenCenter, child, index);
-
- if (isOverScrollChild(index, scrollProgress)) {
- return 1.0f;
- } else if ((showSidePages && inVisibleRange) || index == getNextPage()) {
- scrollProgress = getBoundedScrollProgress(screenCenter, child, index);
- float alpha = 1.0f - 1.0f * Math.abs(scrollProgress / MAX_SCROLL_PROGRESS);
- return alpha;
- } else {
- return 0f;
- }
- }
-
- public float getOutlineAlphaForPage(int screenCenter, int index, boolean showSidePages) {
- boolean inVisibleRange = index >= getNextPage() - 1 && index <= getNextPage() + 1;
- if (inVisibleRange) {
- return super.getOutlineAlphaForPage(screenCenter, index, showSidePages);
- } else {
- return 0f;
- }
- }
-
- private void updatePageAlphaValues(int screenCenter) {
- if (mChildrenOutlineFadeAnimation != null) {
- mChildrenOutlineFadeAnimation.cancel();
- mChildrenOutlineFadeAnimation = null;
- }
- boolean showSidePages = mShowingInitialHints || isPageMoving();
- if (!isReordering(false)) {
- for (int i = 0; i < getChildCount(); i++) {
- KeyguardWidgetFrame child = getWidgetPageAt(i);
- if (child != null) {
- float outlineAlpha = getOutlineAlphaForPage(screenCenter, i, showSidePages);
- float contentAlpha = getAlphaForPage(screenCenter, i,showSidePages);
- child.setBackgroundAlpha(outlineAlpha);
- child.setContentAlpha(contentAlpha);
- }
- }
- }
- }
-
- public void showInitialPageHints() {
- mShowingInitialHints = true;
- int count = getChildCount();
- for (int i = 0; i < count; i++) {
- boolean inVisibleRange = i >= getNextPage() - 1 && i <= getNextPage() + 1;
- KeyguardWidgetFrame child = getWidgetPageAt(i);
- if (inVisibleRange) {
- child.setBackgroundAlpha(KeyguardWidgetFrame.OUTLINE_ALPHA_MULTIPLIER);
- child.setContentAlpha(1f);
- } else {
- child.setBackgroundAlpha(0f);
- child.setContentAlpha(0f);
- }
- }
- }
-
- @Override
- protected void screenScrolled(int screenCenter) {
- mScreenCenter = screenCenter;
- updatePageAlphaValues(screenCenter);
- if (isReordering(false)) return;
- for (int i = 0; i < getChildCount(); i++) {
- KeyguardWidgetFrame v = getWidgetPageAt(i);
- float scrollProgress = getScrollProgress(screenCenter, v, i);
- float boundedProgress = getBoundedScrollProgress(screenCenter, v, i);
- if (v == mDragView || v == null) continue;
- v.setCameraDistance(CAMERA_DISTANCE);
-
- if (isOverScrollChild(i, scrollProgress)) {
- v.setRotationY(- OVERSCROLL_MAX_ROTATION * scrollProgress);
- v.setOverScrollAmount(Math.abs(scrollProgress), scrollProgress < 0);
- } else {
- int width = v.getMeasuredWidth();
- float pivotX = (width / 2f) + boundedProgress * (width / 2f);
- float pivotY = v.getMeasuredHeight() / 2;
- float rotationY = - mAdjacentPagesAngle * boundedProgress;
- v.setPivotX(pivotX);
- v.setPivotY(pivotY);
- v.setRotationY(rotationY);
- v.setOverScrollAmount(0f, false);
- }
- float alpha = v.getAlpha();
- // If the view has 0 alpha, we set it to be invisible so as to prevent
- // it from accepting touches
- if (alpha == 0) {
- v.setVisibility(INVISIBLE);
- } else if (v.getVisibility() != VISIBLE) {
- v.setVisibility(VISIBLE);
- }
- }
- }
-
- void animatePagesToNeutral() {
- if (mChildrenTransformsAnimator != null) {
- mChildrenTransformsAnimator.cancel();
- mChildrenTransformsAnimator = null;
- }
-
- int count = getChildCount();
- PropertyValuesHolder alpha;
- PropertyValuesHolder outlineAlpha;
- PropertyValuesHolder rotationY;
- ArrayList<Animator> anims = new ArrayList<Animator>();
-
- for (int i = 0; i < count; i++) {
- KeyguardWidgetFrame child = getWidgetPageAt(i);
- boolean inVisibleRange = (i >= mCurrentPage - 1 && i <= mCurrentPage + 1);
- if (!inVisibleRange) {
- child.setRotationY(0f);
- }
- alpha = PropertyValuesHolder.ofFloat("contentAlpha", 1.0f);
- outlineAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha",
- KeyguardWidgetFrame.OUTLINE_ALPHA_MULTIPLIER);
- rotationY = PropertyValuesHolder.ofFloat("rotationY", 0f);
- ObjectAnimator a = ObjectAnimator.ofPropertyValuesHolder(child, alpha, outlineAlpha, rotationY);
- child.setVisibility(VISIBLE);
- if (!inVisibleRange) {
- a.setInterpolator(mSlowFadeInterpolator);
- }
- anims.add(a);
- }
-
- int duration = REORDERING_ZOOM_IN_OUT_DURATION;
- mChildrenTransformsAnimator = new AnimatorSet();
- mChildrenTransformsAnimator.playTogether(anims);
-
- mChildrenTransformsAnimator.setDuration(duration);
- mChildrenTransformsAnimator.start();
- }
-
- private void getTransformForPage(int screenCenter, int index, float[] transform) {
- View child = getChildAt(index);
- float boundedProgress = getBoundedScrollProgress(screenCenter, child, index);
- float rotationY = - mAdjacentPagesAngle * boundedProgress;
- int width = child.getMeasuredWidth();
- float pivotX = (width / 2f) + boundedProgress * (width / 2f);
- float pivotY = child.getMeasuredHeight() / 2;
-
- transform[0] = pivotX;
- transform[1] = pivotY;
- transform[2] = rotationY;
- }
-
- Interpolator mFastFadeInterpolator = new Interpolator() {
- Interpolator mInternal = new DecelerateInterpolator(1.5f);
- float mFactor = 2.5f;
- @Override
- public float getInterpolation(float input) {
- return mInternal.getInterpolation(Math.min(mFactor * input, 1f));
- }
- };
-
- Interpolator mSlowFadeInterpolator = new Interpolator() {
- Interpolator mInternal = new AccelerateInterpolator(1.5f);
- float mFactor = 1.3f;
- @Override
- public float getInterpolation(float input) {
- input -= (1 - 1 / mFactor);
- input = mFactor * Math.max(input, 0f);
- return mInternal.getInterpolation(input);
- }
- };
-
- void animatePagesToCarousel() {
- if (mChildrenTransformsAnimator != null) {
- mChildrenTransformsAnimator.cancel();
- mChildrenTransformsAnimator = null;
- }
-
- int count = getChildCount();
- PropertyValuesHolder alpha;
- PropertyValuesHolder outlineAlpha;
- PropertyValuesHolder rotationY;
- PropertyValuesHolder pivotX;
- PropertyValuesHolder pivotY;
- ArrayList<Animator> anims = new ArrayList<Animator>();
-
- for (int i = 0; i < count; i++) {
- KeyguardWidgetFrame child = getWidgetPageAt(i);
- float finalAlpha = getAlphaForPage(mScreenCenter, i, true);
- float finalOutlineAlpha = getOutlineAlphaForPage(mScreenCenter, i, true);
- getTransformForPage(mScreenCenter, i, mTmpTransform);
-
- boolean inVisibleRange = (i >= mCurrentPage - 1 && i <= mCurrentPage + 1);
-
- ObjectAnimator a;
- alpha = PropertyValuesHolder.ofFloat("contentAlpha", finalAlpha);
- outlineAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", finalOutlineAlpha);
- pivotX = PropertyValuesHolder.ofFloat("pivotX", mTmpTransform[0]);
- pivotY = PropertyValuesHolder.ofFloat("pivotY", mTmpTransform[1]);
- rotationY = PropertyValuesHolder.ofFloat("rotationY", mTmpTransform[2]);
-
- if (inVisibleRange) {
- // for the central pages we animate into a rotated state
- a = ObjectAnimator.ofPropertyValuesHolder(child, alpha, outlineAlpha,
- pivotX, pivotY, rotationY);
- } else {
- a = ObjectAnimator.ofPropertyValuesHolder(child, alpha, outlineAlpha);
- a.setInterpolator(mFastFadeInterpolator);
- }
- anims.add(a);
- }
-
- int duration = REORDERING_ZOOM_IN_OUT_DURATION;
- mChildrenTransformsAnimator = new AnimatorSet();
- mChildrenTransformsAnimator.playTogether(anims);
-
- mChildrenTransformsAnimator.setDuration(duration);
- mChildrenTransformsAnimator.start();
- }
-
- protected void reorderStarting() {
- mViewStateManager.fadeOutSecurity(REORDERING_ZOOM_IN_OUT_DURATION);
- animatePagesToNeutral();
- }
-
- protected boolean zoomIn(final Runnable onCompleteRunnable) {
- animatePagesToCarousel();
- return super.zoomIn(onCompleteRunnable);
- }
-
- @Override
- protected void onEndReordering() {
- super.onEndReordering();
- mViewStateManager.fadeInSecurity(REORDERING_ZOOM_IN_OUT_DURATION);
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetFrame.java b/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetFrame.java
deleted file mode 100644
index 8ee9b61..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetFrame.java
+++ /dev/null
@@ -1,519 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import android.animation.Animator;
-import android.animation.ObjectAnimator;
-import android.animation.PropertyValuesHolder;
-import android.appwidget.AppWidgetHostView;
-import android.appwidget.AppWidgetManager;
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Canvas;
-import android.graphics.LinearGradient;
-import android.graphics.Paint;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffXfermode;
-import android.graphics.Rect;
-import android.graphics.Shader;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.View;
-import android.widget.FrameLayout;
-
-public class KeyguardWidgetFrame extends FrameLayout {
- private final static PorterDuffXfermode sAddBlendMode =
- new PorterDuffXfermode(PorterDuff.Mode.ADD);
-
- static final float OUTLINE_ALPHA_MULTIPLIER = 0.6f;
- static final int HOVER_OVER_DELETE_DROP_TARGET_OVERLAY_COLOR = 0x99FF0000;
-
- // Temporarily disable this for the time being until we know why the gfx is messing up
- static final boolean ENABLE_HOVER_OVER_DELETE_DROP_TARGET_OVERLAY = true;
-
- private int mGradientColor;
- private LinearGradient mForegroundGradient;
- private LinearGradient mLeftToRightGradient;
- private LinearGradient mRightToLeftGradient;
- private Paint mGradientPaint = new Paint();
- boolean mLeftToRight = true;
-
- private float mOverScrollAmount = 0f;
- private final Rect mForegroundRect = new Rect();
- private int mForegroundAlpha = 0;
- private CheckLongPressHelper mLongPressHelper;
- private Animator mFrameFade;
- private boolean mIsSmall = false;
- private Handler mWorkerHandler;
-
- private float mBackgroundAlpha;
- private float mContentAlpha;
- private float mBackgroundAlphaMultiplier = 1.0f;
- private Drawable mBackgroundDrawable;
- private Rect mBackgroundRect = new Rect();
-
- // These variables are all needed in order to size things properly before we're actually
- // measured.
- private int mSmallWidgetHeight;
- private int mSmallFrameHeight;
- private boolean mWidgetLockedSmall = false;
- private int mMaxChallengeTop = -1;
- private int mFrameStrokeAdjustment;
- private boolean mPerformAppWidgetSizeUpdateOnBootComplete;
-
- // This will hold the width value before we've actually been measured
- private int mFrameHeight;
-
- private boolean mIsHoveringOverDeleteDropTarget;
-
- // Multiple callers may try and adjust the alpha of the frame. When a caller shows
- // the outlines, we give that caller control, and nobody else can fade them out.
- // This prevents animation conflicts.
- private Object mBgAlphaController;
-
- public KeyguardWidgetFrame(Context context) {
- this(context, null, 0);
- }
-
- public KeyguardWidgetFrame(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public KeyguardWidgetFrame(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
-
- mLongPressHelper = new CheckLongPressHelper(this);
-
- Resources res = context.getResources();
- // TODO: this padding should really correspond to the padding embedded in the background
- // drawable (ie. outlines).
- float density = res.getDisplayMetrics().density;
- int padding = (int) (res.getDisplayMetrics().density * 8);
- setPadding(padding, padding, padding, padding);
-
- mFrameStrokeAdjustment = 2 + (int) (2 * density);
-
- // This will be overriden on phones based on the current security mode, however on tablets
- // we need to specify a height.
- mSmallWidgetHeight =
- res.getDimensionPixelSize(R.dimen.kg_small_widget_height);
- mBackgroundDrawable = res.getDrawable(R.drawable.kg_widget_bg_padded);
- mGradientColor = res.getColor(R.color.kg_widget_pager_gradient);
- mGradientPaint.setXfermode(sAddBlendMode);
- }
-
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- cancelLongPress();
- KeyguardUpdateMonitor.getInstance(mContext).removeCallback(mUpdateMonitorCallbacks);
-
- }
-
- @Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
- KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitorCallbacks);
- }
-
- private KeyguardUpdateMonitorCallback mUpdateMonitorCallbacks =
- new KeyguardUpdateMonitorCallback() {
- @Override
- public void onBootCompleted() {
- if (mPerformAppWidgetSizeUpdateOnBootComplete) {
- performAppWidgetSizeCallbacksIfNecessary();
- mPerformAppWidgetSizeUpdateOnBootComplete = false;
- }
- }
- };
-
- void setIsHoveringOverDeleteDropTarget(boolean isHovering) {
- if (ENABLE_HOVER_OVER_DELETE_DROP_TARGET_OVERLAY) {
- if (mIsHoveringOverDeleteDropTarget != isHovering) {
- mIsHoveringOverDeleteDropTarget = isHovering;
- int resId = isHovering ? R.string.keyguard_accessibility_delete_widget_start
- : R.string.keyguard_accessibility_delete_widget_end;
- String text = getContext().getResources().getString(resId, getContentDescription());
- announceForAccessibility(text);
- invalidate();
- }
- }
- }
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- // Watch for longpress events at this level to make sure
- // users can always pick up this widget
- switch (ev.getAction()) {
- case MotionEvent.ACTION_DOWN:
- mLongPressHelper.postCheckForLongPress(ev);
- break;
- case MotionEvent.ACTION_MOVE:
- mLongPressHelper.onMove(ev);
- break;
- case MotionEvent.ACTION_POINTER_DOWN:
- case MotionEvent.ACTION_UP:
- case MotionEvent.ACTION_CANCEL:
- mLongPressHelper.cancelLongPress();
- break;
- }
-
- // Otherwise continue letting touch events fall through to children
- return false;
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- // Watch for longpress events at this level to make sure
- // users can always pick up this widget
- switch (ev.getAction()) {
- case MotionEvent.ACTION_MOVE:
- mLongPressHelper.onMove(ev);
- break;
- case MotionEvent.ACTION_POINTER_DOWN:
- case MotionEvent.ACTION_UP:
- case MotionEvent.ACTION_CANCEL:
- mLongPressHelper.cancelLongPress();
- break;
- }
-
- // We return true here to ensure that we will get cancel / up signal
- // even if none of our children have requested touch.
- return true;
- }
-
- @Override
- public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
- super.requestDisallowInterceptTouchEvent(disallowIntercept);
- cancelLongPress();
- }
-
- @Override
- public void cancelLongPress() {
- super.cancelLongPress();
- mLongPressHelper.cancelLongPress();
- }
-
-
- private void drawGradientOverlay(Canvas c) {
- mGradientPaint.setShader(mForegroundGradient);
- mGradientPaint.setAlpha(mForegroundAlpha);
- c.drawRect(mForegroundRect, mGradientPaint);
- }
-
- private void drawHoveringOverDeleteOverlay(Canvas c) {
- if (mIsHoveringOverDeleteDropTarget) {
- c.drawColor(HOVER_OVER_DELETE_DROP_TARGET_OVERLAY_COLOR);
- }
- }
-
- protected void drawBg(Canvas canvas) {
- if (mBackgroundAlpha > 0.0f) {
- Drawable bg = mBackgroundDrawable;
-
- bg.setAlpha((int) (mBackgroundAlpha * mBackgroundAlphaMultiplier * 255));
- bg.setBounds(mBackgroundRect);
- bg.draw(canvas);
- }
- }
-
- @Override
- protected void dispatchDraw(Canvas canvas) {
- if (ENABLE_HOVER_OVER_DELETE_DROP_TARGET_OVERLAY) {
- canvas.save();
- }
- drawBg(canvas);
- super.dispatchDraw(canvas);
- drawGradientOverlay(canvas);
- if (ENABLE_HOVER_OVER_DELETE_DROP_TARGET_OVERLAY) {
- drawHoveringOverDeleteOverlay(canvas);
- canvas.restore();
- }
- }
-
- /**
- * Because this view has fading outlines, it is essential that we enable hardware
- * layers on the content (child) so that updating the alpha of the outlines doesn't
- * result in the content layer being recreated.
- */
- public void enableHardwareLayersForContent() {
- View widget = getContent();
- if (widget != null && widget.isHardwareAccelerated()) {
- widget.setLayerType(LAYER_TYPE_HARDWARE, null);
- }
- }
-
- /**
- * Because this view has fading outlines, it is essential that we enable hardware
- * layers on the content (child) so that updating the alpha of the outlines doesn't
- * result in the content layer being recreated.
- */
- public void disableHardwareLayersForContent() {
- View widget = getContent();
- if (widget != null) {
- widget.setLayerType(LAYER_TYPE_NONE, null);
- }
- }
-
- public View getContent() {
- return getChildAt(0);
- }
-
- public int getContentAppWidgetId() {
- View content = getContent();
- if (content instanceof AppWidgetHostView) {
- return ((AppWidgetHostView) content).getAppWidgetId();
- } else if (content instanceof KeyguardStatusView) {
- return ((KeyguardStatusView) content).getAppWidgetId();
- } else {
- return AppWidgetManager.INVALID_APPWIDGET_ID;
- }
- }
-
- public float getBackgroundAlpha() {
- return mBackgroundAlpha;
- }
-
- public void setBackgroundAlphaMultiplier(float multiplier) {
- if (Float.compare(mBackgroundAlphaMultiplier, multiplier) != 0) {
- mBackgroundAlphaMultiplier = multiplier;
- invalidate();
- }
- }
-
- public float getBackgroundAlphaMultiplier() {
- return mBackgroundAlphaMultiplier;
- }
-
- public void setBackgroundAlpha(float alpha) {
- if (Float.compare(mBackgroundAlpha, alpha) != 0) {
- mBackgroundAlpha = alpha;
- invalidate();
- }
- }
-
- public float getContentAlpha() {
- return mContentAlpha;
- }
-
- public void setContentAlpha(float alpha) {
- mContentAlpha = alpha;
- View content = getContent();
- if (content != null) {
- content.setAlpha(alpha);
- }
- }
-
- /**
- * Depending on whether the security is up, the widget size needs to change
- *
- * @param height The height of the widget, -1 for full height
- */
- private void setWidgetHeight(int height) {
- boolean needLayout = false;
- View widget = getContent();
- if (widget != null) {
- LayoutParams lp = (LayoutParams) widget.getLayoutParams();
- if (lp.height != height) {
- needLayout = true;
- lp.height = height;
- }
- }
- if (needLayout) {
- requestLayout();
- }
- }
-
- public void setMaxChallengeTop(int top) {
- boolean dirty = mMaxChallengeTop != top;
- mMaxChallengeTop = top;
- mSmallWidgetHeight = top - getPaddingTop();
- mSmallFrameHeight = top + getPaddingBottom();
- if (dirty && mIsSmall) {
- setWidgetHeight(mSmallWidgetHeight);
- setFrameHeight(mSmallFrameHeight);
- } else if (dirty && mWidgetLockedSmall) {
- setWidgetHeight(mSmallWidgetHeight);
- }
- }
-
- public boolean isSmall() {
- return mIsSmall;
- }
-
- public void adjustFrame(int challengeTop) {
- int frameHeight = challengeTop + getPaddingBottom();
- setFrameHeight(frameHeight);
- }
-
- public void shrinkWidget(boolean alsoShrinkFrame) {
- mIsSmall = true;
- setWidgetHeight(mSmallWidgetHeight);
-
- if (alsoShrinkFrame) {
- setFrameHeight(mSmallFrameHeight);
- }
- }
-
- public int getSmallFrameHeight() {
- return mSmallFrameHeight;
- }
-
- public void setWidgetLockedSmall(boolean locked) {
- if (locked) {
- setWidgetHeight(mSmallWidgetHeight);
- }
- mWidgetLockedSmall = locked;
- }
-
- public void resetSize() {
- mIsSmall = false;
- if (!mWidgetLockedSmall) {
- setWidgetHeight(LayoutParams.MATCH_PARENT);
- }
- setFrameHeight(getMeasuredHeight());
- }
-
- public void setFrameHeight(int height) {
- mFrameHeight = height;
- mBackgroundRect.set(0, 0, getMeasuredWidth(), Math.min(mFrameHeight, getMeasuredHeight()));
- mForegroundRect.set(mFrameStrokeAdjustment, mFrameStrokeAdjustment,getMeasuredWidth() -
- mFrameStrokeAdjustment, Math.min(getMeasuredHeight(), mFrameHeight) -
- mFrameStrokeAdjustment);
- updateGradient();
- invalidate();
- }
-
- public void hideFrame(Object caller) {
- fadeFrame(caller, false, 0f, KeyguardWidgetPager.CHILDREN_OUTLINE_FADE_OUT_DURATION);
- }
-
- public void showFrame(Object caller) {
- fadeFrame(caller, true, OUTLINE_ALPHA_MULTIPLIER,
- KeyguardWidgetPager.CHILDREN_OUTLINE_FADE_IN_DURATION);
- }
-
- public void fadeFrame(Object caller, boolean takeControl, float alpha, int duration) {
- if (takeControl) {
- mBgAlphaController = caller;
- }
-
- if (mBgAlphaController != caller && mBgAlphaController != null) {
- return;
- }
-
- if (mFrameFade != null) {
- mFrameFade.cancel();
- mFrameFade = null;
- }
- PropertyValuesHolder bgAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", alpha);
- mFrameFade = ObjectAnimator.ofPropertyValuesHolder(this, bgAlpha);
- mFrameFade.setDuration(duration);
- mFrameFade.start();
- }
-
- private void updateGradient() {
- float x0 = mLeftToRight ? 0 : mForegroundRect.width();
- float x1 = mLeftToRight ? mForegroundRect.width(): 0;
- mLeftToRightGradient = new LinearGradient(x0, 0f, x1, 0f,
- mGradientColor, 0, Shader.TileMode.CLAMP);
- mRightToLeftGradient = new LinearGradient(x1, 0f, x0, 0f,
- mGradientColor, 0, Shader.TileMode.CLAMP);
- }
-
- @Override
- protected void onSizeChanged(int w, int h, int oldw, int oldh) {
- super.onSizeChanged(w, h, oldw, oldh);
-
- if (!mIsSmall) {
- mFrameHeight = h;
- }
-
- // mFrameStrokeAdjustment is a cludge to prevent the overlay from drawing outside the
- // rounded rect background.
- mForegroundRect.set(mFrameStrokeAdjustment, mFrameStrokeAdjustment,
- w - mFrameStrokeAdjustment, Math.min(h, mFrameHeight) - mFrameStrokeAdjustment);
-
- mBackgroundRect.set(0, 0, getMeasuredWidth(), Math.min(h, mFrameHeight));
- updateGradient();
- invalidate();
- }
-
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- performAppWidgetSizeCallbacksIfNecessary();
- }
-
- private void performAppWidgetSizeCallbacksIfNecessary() {
- View content = getContent();
- if (!(content instanceof AppWidgetHostView)) return;
-
- if (!KeyguardUpdateMonitor.getInstance(mContext).hasBootCompleted()) {
- mPerformAppWidgetSizeUpdateOnBootComplete = true;
- return;
- }
-
- // TODO: there's no reason to force the AppWidgetHostView to catch duplicate size calls.
- // We can do that even more cheaply here. It's not an issue right now since we're in the
- // system process and hence no binder calls.
- AppWidgetHostView awhv = (AppWidgetHostView) content;
- float density = getResources().getDisplayMetrics().density;
-
- int width = (int) (content.getMeasuredWidth() / density);
- int height = (int) (content.getMeasuredHeight() / density);
- awhv.updateAppWidgetSize(null, width, height, width, height, true);
- }
-
- void setOverScrollAmount(float r, boolean left) {
- if (Float.compare(mOverScrollAmount, r) != 0) {
- mOverScrollAmount = r;
- mForegroundGradient = left ? mLeftToRightGradient : mRightToLeftGradient;
- mForegroundAlpha = (int) Math.round((0.5f * r * 255));
-
- // We bump up the alpha of the outline to hide the fact that the overlay is drawing
- // over the rounded part of the frame.
- float bgAlpha = Math.min(OUTLINE_ALPHA_MULTIPLIER + r * (1 - OUTLINE_ALPHA_MULTIPLIER),
- 1f);
- setBackgroundAlpha(bgAlpha);
- invalidate();
- }
- }
-
- public void onActive(boolean isActive) {
- // hook for subclasses
- }
-
- public boolean onUserInteraction(MotionEvent event) {
- // hook for subclasses
- return false;
- }
-
- public void onBouncerShowing(boolean showing) {
- // hook for subclasses
- }
-
- public void setWorkerHandler(Handler workerHandler) {
- mWorkerHandler = workerHandler;
- }
-
- public Handler getWorkerHandler() {
- return mWorkerHandler;
- }
-
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetPager.java b/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetPager.java
deleted file mode 100644
index 6120127..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetPager.java
+++ /dev/null
@@ -1,967 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.keyguard;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
-import android.animation.PropertyValuesHolder;
-import android.animation.TimeInterpolator;
-import android.appwidget.AppWidgetHostView;
-import android.appwidget.AppWidgetManager;
-import android.appwidget.AppWidgetProviderInfo;
-import android.content.Context;
-import android.os.Handler;
-import android.os.HandlerThread;
-import android.text.format.DateFormat;
-import android.util.AttributeSet;
-import android.util.Slog;
-import android.view.Gravity;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.View.OnLongClickListener;
-import android.view.ViewGroup;
-import android.view.accessibility.AccessibilityEvent;
-import android.view.accessibility.AccessibilityManager;
-import android.view.animation.DecelerateInterpolator;
-import android.widget.FrameLayout;
-import android.widget.TextClock;
-
-import com.android.internal.widget.LockPatternUtils;
-
-import java.util.ArrayList;
-import java.util.TimeZone;
-
-public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwitchListener,
- OnLongClickListener, ChallengeLayout.OnBouncerStateChangedListener {
-
- ZInterpolator mZInterpolator = new ZInterpolator(0.5f);
- private static float CAMERA_DISTANCE = 10000;
- protected static float OVERSCROLL_MAX_ROTATION = 30;
- private static final boolean PERFORM_OVERSCROLL_ROTATION = true;
-
- private static final int FLAG_HAS_LOCAL_HOUR = 0x1;
- private static final int FLAG_HAS_LOCAL_MINUTE = 0x2;
-
- protected KeyguardViewStateManager mViewStateManager;
- private LockPatternUtils mLockPatternUtils;
-
- // Related to the fading in / out background outlines
- public static final int CHILDREN_OUTLINE_FADE_OUT_DURATION = 375;
- public static final int CHILDREN_OUTLINE_FADE_IN_DURATION = 100;
- protected AnimatorSet mChildrenOutlineFadeAnimation;
- protected int mScreenCenter;
- private boolean mHasMeasure = false;
- boolean showHintsAfterLayout = false;
-
- private static final long CUSTOM_WIDGET_USER_ACTIVITY_TIMEOUT = 30000;
- private static final String TAG = "KeyguardWidgetPager";
- private boolean mCenterSmallWidgetsVertically;
-
- private int mPage = 0;
- private Callbacks mCallbacks;
-
- private int mWidgetToResetAfterFadeOut;
- protected boolean mShowingInitialHints = false;
-
- // A temporary handle to the Add-Widget view
- private View mAddWidgetView;
- private int mLastWidthMeasureSpec;
- private int mLastHeightMeasureSpec;
-
- // Bouncer
- private int mBouncerZoomInOutDuration = 250;
- private float BOUNCER_SCALE_FACTOR = 0.67f;
-
- // Background worker thread: used here for persistence, also made available to widget frames
- private final HandlerThread mBackgroundWorkerThread;
- private final Handler mBackgroundWorkerHandler;
- private boolean mCameraEventInProgress;
-
- public KeyguardWidgetPager(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public KeyguardWidgetPager(Context context) {
- this(null, null, 0);
- }
-
- public KeyguardWidgetPager(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- if (getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
- setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
- }
-
- setPageSwitchListener(this);
-
- mBackgroundWorkerThread = new HandlerThread("KeyguardWidgetPager Worker");
- mBackgroundWorkerThread.start();
- mBackgroundWorkerHandler = new Handler(mBackgroundWorkerThread.getLooper());
- }
-
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
-
- // Clean up the worker thread
- mBackgroundWorkerThread.quit();
- }
-
- public void setViewStateManager(KeyguardViewStateManager viewStateManager) {
- mViewStateManager = viewStateManager;
- }
-
- public void setLockPatternUtils(LockPatternUtils l) {
- mLockPatternUtils = l;
- }
-
- @Override
- public void onPageSwitching(View newPage, int newPageIndex) {
- if (mViewStateManager != null) {
- mViewStateManager.onPageSwitching(newPage, newPageIndex);
- }
- }
-
- @Override
- public void onPageSwitched(View newPage, int newPageIndex) {
- boolean showingClock = false;
- if (newPage instanceof ViewGroup) {
- ViewGroup vg = (ViewGroup) newPage;
- if (vg.getChildAt(0) instanceof KeyguardStatusView) {
- showingClock = true;
- }
- }
-
- if (newPage != null &&
- findClockInHierarchy(newPage) == (FLAG_HAS_LOCAL_HOUR | FLAG_HAS_LOCAL_MINUTE)) {
- showingClock = true;
- }
-
- // Disable the status bar clock if we're showing the default status widget
- if (showingClock) {
- setSystemUiVisibility(getSystemUiVisibility() | View.STATUS_BAR_DISABLE_CLOCK);
- } else {
- setSystemUiVisibility(getSystemUiVisibility() & ~View.STATUS_BAR_DISABLE_CLOCK);
- }
-
- // Extend the display timeout if the user switches pages
- if (mPage != newPageIndex) {
- int oldPageIndex = mPage;
- mPage = newPageIndex;
- userActivity();
- KeyguardWidgetFrame oldWidgetPage = getWidgetPageAt(oldPageIndex);
- if (oldWidgetPage != null) {
- oldWidgetPage.onActive(false);
- }
- KeyguardWidgetFrame newWidgetPage = getWidgetPageAt(newPageIndex);
- if (newWidgetPage != null) {
- newWidgetPage.onActive(true);
- newWidgetPage.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
- newWidgetPage.requestAccessibilityFocus();
- }
- if (mParent != null && AccessibilityManager.getInstance(mContext).isEnabled()) {
- AccessibilityEvent event = AccessibilityEvent.obtain(
- AccessibilityEvent.TYPE_VIEW_SCROLLED);
- onInitializeAccessibilityEvent(event);
- onPopulateAccessibilityEvent(event);
- mParent.requestSendAccessibilityEvent(this, event);
- }
- }
- if (mViewStateManager != null) {
- mViewStateManager.onPageSwitched(newPage, newPageIndex);
- }
- }
-
- @Override
- public void onPageBeginWarp() {
- showOutlinesAndSidePages();
- mViewStateManager.onPageBeginWarp();
- }
-
- @Override
- public void onPageEndWarp() {
- // if we're moving to the warp page, then immediately hide the other widgets.
- int duration = getPageWarpIndex() == getNextPage() ? 0 : -1;
- animateOutlinesAndSidePages(false, duration);
- mViewStateManager.onPageEndWarp();
- }
-
- @Override
- public void sendAccessibilityEvent(int eventType) {
- if (eventType != AccessibilityEvent.TYPE_VIEW_SCROLLED || isPageMoving()) {
- super.sendAccessibilityEvent(eventType);
- }
- }
-
- private void updateWidgetFramesImportantForAccessibility() {
- final int pageCount = getPageCount();
- for (int i = 0; i < pageCount; i++) {
- KeyguardWidgetFrame frame = getWidgetPageAt(i);
- updateWidgetFrameImportantForAccessibility(frame);
- }
- }
-
- private void updateWidgetFrameImportantForAccessibility(KeyguardWidgetFrame frame) {
- if (frame.getContentAlpha() <= 0) {
- frame.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
- } else {
- frame.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
- }
- }
-
- private void userActivity() {
- if (mCallbacks != null) {
- mCallbacks.onUserActivityTimeoutChanged();
- mCallbacks.userActivity();
- }
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- return captureUserInteraction(ev) || super.onTouchEvent(ev);
- }
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- return captureUserInteraction(ev) || super.onInterceptTouchEvent(ev);
- }
-
- private boolean captureUserInteraction(MotionEvent ev) {
- KeyguardWidgetFrame currentWidgetPage = getWidgetPageAt(getCurrentPage());
- return currentWidgetPage != null && currentWidgetPage.onUserInteraction(ev);
- }
-
- public void showPagingFeedback() {
- // Nothing yet.
- }
-
- public long getUserActivityTimeout() {
- View page = getPageAt(mPage);
- if (page instanceof ViewGroup) {
- ViewGroup vg = (ViewGroup) page;
- View view = vg.getChildAt(0);
- if (!(view instanceof KeyguardStatusView)
- && !(view instanceof KeyguardMultiUserSelectorView)) {
- return CUSTOM_WIDGET_USER_ACTIVITY_TIMEOUT;
- }
- }
- return -1;
- }
-
- public void setCallbacks(Callbacks callbacks) {
- mCallbacks = callbacks;
- }
-
- public interface Callbacks {
- public void userActivity();
- public void onUserActivityTimeoutChanged();
- public void onAddView(View v);
- public void onRemoveView(View v, boolean deletePermanently);
- public void onRemoveViewAnimationCompleted();
- }
-
- public void addWidget(View widget) {
- addWidget(widget, -1);
- }
-
- public void onRemoveView(View v, final boolean deletePermanently) {
- final int appWidgetId = ((KeyguardWidgetFrame) v).getContentAppWidgetId();
- if (mCallbacks != null) {
- mCallbacks.onRemoveView(v, deletePermanently);
- }
- mBackgroundWorkerHandler.post(new Runnable() {
- @Override
- public void run() {
- mLockPatternUtils.removeAppWidget(appWidgetId);
- }
- });
- }
-
- @Override
- public void onRemoveViewAnimationCompleted() {
- if (mCallbacks != null) {
- mCallbacks.onRemoveViewAnimationCompleted();
- }
- }
-
- public void onAddView(View v, final int index) {
- final int appWidgetId = ((KeyguardWidgetFrame) v).getContentAppWidgetId();
- final int[] pagesRange = new int[mTempVisiblePagesRange.length];
- getVisiblePages(pagesRange);
- boundByReorderablePages(true, pagesRange);
- if (mCallbacks != null) {
- mCallbacks.onAddView(v);
- }
- // Subtract from the index to take into account pages before the reorderable
- // pages (e.g. the "add widget" page)
- mBackgroundWorkerHandler.post(new Runnable() {
- @Override
- public void run() {
- mLockPatternUtils.addAppWidget(appWidgetId, index - pagesRange[0]);
- }
- });
- }
-
- /*
- * We wrap widgets in a special frame which handles drawing the over scroll foreground.
- */
- public void addWidget(View widget, int pageIndex) {
- KeyguardWidgetFrame frame;
- // All views contained herein should be wrapped in a KeyguardWidgetFrame
- if (!(widget instanceof KeyguardWidgetFrame)) {
- frame = new KeyguardWidgetFrame(getContext());
- FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
- LayoutParams.MATCH_PARENT);
- lp.gravity = Gravity.TOP;
-
- // The framework adds a default padding to AppWidgetHostView. We don't need this padding
- // for the Keyguard, so we override it to be 0.
- widget.setPadding(0, 0, 0, 0);
- frame.addView(widget, lp);
-
- // We set whether or not this widget supports vertical resizing.
- if (widget instanceof AppWidgetHostView) {
- AppWidgetHostView awhv = (AppWidgetHostView) widget;
- AppWidgetProviderInfo info = awhv.getAppWidgetInfo();
- if ((info.resizeMode & AppWidgetProviderInfo.RESIZE_VERTICAL) != 0) {
- frame.setWidgetLockedSmall(false);
- } else {
- // Lock the widget to be small.
- frame.setWidgetLockedSmall(true);
- if (mCenterSmallWidgetsVertically) {
- lp.gravity = Gravity.CENTER;
- }
- }
- }
- } else {
- frame = (KeyguardWidgetFrame) widget;
- }
-
- ViewGroup.LayoutParams pageLp = new ViewGroup.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
- frame.setOnLongClickListener(this);
- frame.setWorkerHandler(mBackgroundWorkerHandler);
-
- if (pageIndex == -1) {
- addView(frame, pageLp);
- } else {
- addView(frame, pageIndex, pageLp);
- }
-
- // Update the frame content description.
- View content = (widget == frame) ? frame.getContent() : widget;
- if (content != null) {
- String contentDescription = mContext.getString(
- R.string.keyguard_accessibility_widget,
- content.getContentDescription());
- frame.setContentDescription(contentDescription);
- }
- updateWidgetFrameImportantForAccessibility(frame);
- }
-
- /**
- * Use addWidget() instead.
- * @deprecated
- */
- @Override
- public void addView(View child, int index) {
- enforceKeyguardWidgetFrame(child);
- super.addView(child, index);
- }
-
- /**
- * Use addWidget() instead.
- * @deprecated
- */
- @Override
- public void addView(View child, int width, int height) {
- enforceKeyguardWidgetFrame(child);
- super.addView(child, width, height);
- }
-
- /**
- * Use addWidget() instead.
- * @deprecated
- */
- @Override
- public void addView(View child, LayoutParams params) {
- enforceKeyguardWidgetFrame(child);
- super.addView(child, params);
- }
-
- /**
- * Use addWidget() instead.
- * @deprecated
- */
- @Override
- public void addView(View child, int index, LayoutParams params) {
- enforceKeyguardWidgetFrame(child);
- super.addView(child, index, params);
- }
-
- private void enforceKeyguardWidgetFrame(View child) {
- if (!(child instanceof KeyguardWidgetFrame)) {
- throw new IllegalArgumentException(
- "KeyguardWidgetPager children must be KeyguardWidgetFrames");
- }
- }
-
- public KeyguardWidgetFrame getWidgetPageAt(int index) {
- // This is always a valid cast as we've guarded the ability to
- return (KeyguardWidgetFrame) getChildAt(index);
- }
-
- protected void onUnhandledTap(MotionEvent ev) {
- showPagingFeedback();
- }
-
- @Override
- protected void onPageBeginMoving() {
- if (mViewStateManager != null) {
- mViewStateManager.onPageBeginMoving();
- }
- if (!isReordering(false)) {
- showOutlinesAndSidePages();
- }
- userActivity();
- }
-
- @Override
- protected void onPageEndMoving() {
- if (mViewStateManager != null) {
- mViewStateManager.onPageEndMoving();
- }
-
- // In the reordering case, the pages will be faded appropriately on completion
- // of the zoom in animation.
- if (!isReordering(false)) {
- hideOutlinesAndSidePages();
- }
- }
-
- protected void enablePageContentLayers() {
- int children = getChildCount();
- for (int i = 0; i < children; i++) {
- getWidgetPageAt(i).enableHardwareLayersForContent();
- }
- }
-
- protected void disablePageContentLayers() {
- int children = getChildCount();
- for (int i = 0; i < children; i++) {
- getWidgetPageAt(i).disableHardwareLayersForContent();
- }
- }
-
- /*
- * This interpolator emulates the rate at which the perceived scale of an object changes
- * as its distance from a camera increases. When this interpolator is applied to a scale
- * animation on a view, it evokes the sense that the object is shrinking due to moving away
- * from the camera.
- */
- static class ZInterpolator implements TimeInterpolator {
- private float focalLength;
-
- public ZInterpolator(float foc) {
- focalLength = foc;
- }
-
- public float getInterpolation(float input) {
- return (1.0f - focalLength / (focalLength + input)) /
- (1.0f - focalLength / (focalLength + 1.0f));
- }
- }
-
- @Override
- protected void overScroll(float amount) {
- acceleratedOverScroll(amount);
- }
-
- float backgroundAlphaInterpolator(float r) {
- return Math.min(1f, r);
- }
-
- private void updatePageAlphaValues(int screenCenter) {
- }
-
- public float getAlphaForPage(int screenCenter, int index, boolean showSidePages) {
- if (isWarping()) {
- return index == getPageWarpIndex() ? 1.0f : 0.0f;
- }
- if (showSidePages) {
- return 1f;
- } else {
- return index == mCurrentPage ? 1.0f : 0f;
- }
- }
-
- public float getOutlineAlphaForPage(int screenCenter, int index, boolean showSidePages) {
- if (showSidePages) {
- return getAlphaForPage(screenCenter, index, showSidePages)
- * KeyguardWidgetFrame.OUTLINE_ALPHA_MULTIPLIER;
- } else {
- return 0f;
- }
- }
-
- protected boolean isOverScrollChild(int index, float scrollProgress) {
- boolean isInOverscroll = mOverScrollX < 0 || mOverScrollX > mMaxScrollX;
- return (isInOverscroll && (index == 0 && scrollProgress < 0 ||
- index == getChildCount() - 1 && scrollProgress > 0));
- }
-
- @Override
- protected void screenScrolled(int screenCenter) {
- mScreenCenter = screenCenter;
- updatePageAlphaValues(screenCenter);
- for (int i = 0; i < getChildCount(); i++) {
- KeyguardWidgetFrame v = getWidgetPageAt(i);
- if (v == mDragView) continue;
- if (v != null) {
- float scrollProgress = getScrollProgress(screenCenter, v, i);
-
- v.setCameraDistance(mDensity * CAMERA_DISTANCE);
-
- if (isOverScrollChild(i, scrollProgress) && PERFORM_OVERSCROLL_ROTATION) {
- float pivotX = v.getMeasuredWidth() / 2;
- float pivotY = v.getMeasuredHeight() / 2;
- v.setPivotX(pivotX);
- v.setPivotY(pivotY);
- v.setRotationY(- OVERSCROLL_MAX_ROTATION * scrollProgress);
- v.setOverScrollAmount(Math.abs(scrollProgress), scrollProgress < 0);
- } else {
- v.setRotationY(0f);
- v.setOverScrollAmount(0, false);
- }
-
- float alpha = v.getAlpha();
- // If the view has 0 alpha, we set it to be invisible so as to prevent
- // it from accepting touches
- if (alpha == 0) {
- v.setVisibility(INVISIBLE);
- } else if (v.getVisibility() != VISIBLE) {
- v.setVisibility(VISIBLE);
- }
- }
- }
- }
-
- public boolean isWidgetPage(int pageIndex) {
- if (pageIndex < 0 || pageIndex >= getChildCount()) {
- return false;
- }
- View v = getChildAt(pageIndex);
- if (v != null && v instanceof KeyguardWidgetFrame) {
- KeyguardWidgetFrame kwf = (KeyguardWidgetFrame) v;
- return kwf.getContentAppWidgetId() != AppWidgetManager.INVALID_APPWIDGET_ID;
- }
- return false;
- }
-
- /**
- * Returns the bounded set of pages that are re-orderable. The range is fully inclusive.
- */
- @Override
- void boundByReorderablePages(boolean isReordering, int[] range) {
- if (isReordering) {
- // Remove non-widget pages from the range
- while (range[1] >= range[0] && !isWidgetPage(range[1])) {
- range[1]--;
- }
- while (range[0] <= range[1] && !isWidgetPage(range[0])) {
- range[0]++;
- }
- }
- }
-
- protected void reorderStarting() {
- showOutlinesAndSidePages();
- }
-
- @Override
- protected void onStartReordering() {
- super.onStartReordering();
- enablePageContentLayers();
- reorderStarting();
- }
-
- @Override
- protected void onEndReordering() {
- super.onEndReordering();
- hideOutlinesAndSidePages();
- }
-
- void showOutlinesAndSidePages() {
- animateOutlinesAndSidePages(true);
- }
-
- void hideOutlinesAndSidePages() {
- animateOutlinesAndSidePages(false);
- }
-
- void updateChildrenContentAlpha(float sidePageAlpha) {
- int count = getChildCount();
- for (int i = 0; i < count; i++) {
- KeyguardWidgetFrame child = getWidgetPageAt(i);
- if (i != mCurrentPage) {
- child.setBackgroundAlpha(sidePageAlpha);
- child.setContentAlpha(0f);
- } else {
- child.setBackgroundAlpha(0f);
- child.setContentAlpha(1f);
- }
- }
- }
-
- public void showInitialPageHints() {
- mShowingInitialHints = true;
- updateChildrenContentAlpha(KeyguardWidgetFrame.OUTLINE_ALPHA_MULTIPLIER);
- }
-
- @Override
- void setCurrentPage(int currentPage) {
- super.setCurrentPage(currentPage);
- updateChildrenContentAlpha(0.0f);
- updateWidgetFramesImportantForAccessibility();
- }
-
- @Override
- public void onAttachedToWindow() {
- super.onAttachedToWindow();
- mHasMeasure = false;
- }
-
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- mLastWidthMeasureSpec = widthMeasureSpec;
- mLastHeightMeasureSpec = heightMeasureSpec;
-
- int maxChallengeTop = -1;
- View parent = (View) getParent();
- boolean challengeShowing = false;
- // Widget pages need to know where the top of the sliding challenge is so that they
- // now how big the widget should be when the challenge is up. We compute it here and
- // then propagate it to each of our children.
- if (parent.getParent() instanceof SlidingChallengeLayout) {
- SlidingChallengeLayout scl = (SlidingChallengeLayout) parent.getParent();
- int top = scl.getMaxChallengeTop();
-
- // This is a bit evil, but we need to map a coordinate relative to the SCL into a
- // coordinate relative to our children, hence we subtract the top padding.s
- maxChallengeTop = top - getPaddingTop();
- challengeShowing = scl.isChallengeShowing();
-
- int count = getChildCount();
- for (int i = 0; i < count; i++) {
- KeyguardWidgetFrame frame = getWidgetPageAt(i);
- frame.setMaxChallengeTop(maxChallengeTop);
- // On the very first measure pass, if the challenge is showing, we need to make sure
- // that the widget on the current page is small.
- if (challengeShowing && i == mCurrentPage && !mHasMeasure) {
- frame.shrinkWidget(true);
- }
- }
- }
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- mHasMeasure = true;
- }
-
- void animateOutlinesAndSidePages(final boolean show) {
- animateOutlinesAndSidePages(show, -1);
- }
-
- public void setWidgetToResetOnPageFadeOut(int widget) {
- mWidgetToResetAfterFadeOut = widget;
- }
-
- public int getWidgetToResetOnPageFadeOut() {
- return mWidgetToResetAfterFadeOut;
- }
-
- void animateOutlinesAndSidePages(final boolean show, int duration) {
- if (mChildrenOutlineFadeAnimation != null) {
- mChildrenOutlineFadeAnimation.cancel();
- mChildrenOutlineFadeAnimation = null;
- }
- int count = getChildCount();
- PropertyValuesHolder alpha;
- ArrayList<Animator> anims = new ArrayList<Animator>();
-
- if (duration == -1) {
- duration = show ? CHILDREN_OUTLINE_FADE_IN_DURATION :
- CHILDREN_OUTLINE_FADE_OUT_DURATION;
- }
-
- int curPage = getNextPage();
- for (int i = 0; i < count; i++) {
- float finalContentAlpha;
- if (show) {
- finalContentAlpha = getAlphaForPage(mScreenCenter, i, true);
- } else if (!show && i == curPage) {
- finalContentAlpha = 1f;
- } else {
- finalContentAlpha = 0f;
- }
- KeyguardWidgetFrame child = getWidgetPageAt(i);
-
- alpha = PropertyValuesHolder.ofFloat("contentAlpha", finalContentAlpha);
- ObjectAnimator a = ObjectAnimator.ofPropertyValuesHolder(child, alpha);
- anims.add(a);
-
- float finalOutlineAlpha = show ? getOutlineAlphaForPage(mScreenCenter, i, true) : 0f;
- child.fadeFrame(this, show, finalOutlineAlpha, duration);
- }
-
- mChildrenOutlineFadeAnimation = new AnimatorSet();
- mChildrenOutlineFadeAnimation.playTogether(anims);
-
- mChildrenOutlineFadeAnimation.setDuration(duration);
- mChildrenOutlineFadeAnimation.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- if (show) {
- enablePageContentLayers();
- }
- }
-
- @Override
- public void onAnimationEnd(Animator animation) {
- if (!show) {
- disablePageContentLayers();
- KeyguardWidgetFrame frame = getWidgetPageAt(mWidgetToResetAfterFadeOut);
- if (frame != null && !(frame == getWidgetPageAt(mCurrentPage) &&
- mViewStateManager.isChallengeOverlapping())) {
- frame.resetSize();
- }
- mWidgetToResetAfterFadeOut = -1;
- mShowingInitialHints = false;
- }
- updateWidgetFramesImportantForAccessibility();
- }
- });
- mChildrenOutlineFadeAnimation.start();
- }
-
- @Override
- public boolean onLongClick(View v) {
- // Disallow long pressing to reorder if the challenge is showing
- boolean isChallengeOverlapping = mViewStateManager.isChallengeShowing() &&
- mViewStateManager.isChallengeOverlapping();
- if (!isChallengeOverlapping && startReordering()) {
- return true;
- }
- return false;
- }
-
- public void removeWidget(View view) {
- if (view instanceof KeyguardWidgetFrame) {
- removeView(view);
- } else {
- // Assume view was wrapped by a KeyguardWidgetFrame in KeyguardWidgetPager#addWidget().
- // This supports legacy hard-coded "widgets" like KeyguardTransportControlView.
- int pos = getWidgetPageIndex(view);
- if (pos != -1) {
- KeyguardWidgetFrame frame = (KeyguardWidgetFrame) getChildAt(pos);
- frame.removeView(view);
- removeView(frame);
- } else {
- Slog.w(TAG, "removeWidget() can't find:" + view);
- }
- }
- }
-
- public int getWidgetPageIndex(View view) {
- if (view instanceof KeyguardWidgetFrame) {
- return indexOfChild(view);
- } else {
- // View was wrapped by a KeyguardWidgetFrame by KeyguardWidgetPager#addWidget()
- return indexOfChild((KeyguardWidgetFrame)view.getParent());
- }
- }
-
- @Override
- protected void setPageHoveringOverDeleteDropTarget(int viewIndex, boolean isHovering) {
- KeyguardWidgetFrame child = getWidgetPageAt(viewIndex);
- child.setIsHoveringOverDeleteDropTarget(isHovering);
- }
-
- // ChallengeLayout.OnBouncerStateChangedListener
- @Override
- public void onBouncerStateChanged(boolean bouncerActive) {
- if (bouncerActive) {
- zoomOutToBouncer();
- } else {
- zoomInFromBouncer();
- }
- }
-
- void setBouncerAnimationDuration(int duration) {
- mBouncerZoomInOutDuration = duration;
- }
-
- // Zoom in after the bouncer is dismissed
- void zoomInFromBouncer() {
- if (mZoomInOutAnim != null && mZoomInOutAnim.isRunning()) {
- mZoomInOutAnim.cancel();
- }
- final View currentPage = getPageAt(getCurrentPage());
- if (currentPage.getScaleX() < 1f || currentPage.getScaleY() < 1f) {
- mZoomInOutAnim = new AnimatorSet();
- mZoomInOutAnim.playTogether(
- ObjectAnimator.ofFloat(currentPage, "scaleX", 1f),
- ObjectAnimator.ofFloat(currentPage , "scaleY", 1f));
- mZoomInOutAnim.setDuration(mBouncerZoomInOutDuration);
- mZoomInOutAnim.setInterpolator(new DecelerateInterpolator(1.5f));
- mZoomInOutAnim.start();
- }
- if (currentPage instanceof KeyguardWidgetFrame) {
- ((KeyguardWidgetFrame)currentPage).onBouncerShowing(false);
- }
- }
-
- // Zoom out after the bouncer is initiated
- void zoomOutToBouncer() {
- if (mZoomInOutAnim != null && mZoomInOutAnim.isRunning()) {
- mZoomInOutAnim.cancel();
- }
- int curPage = getCurrentPage();
- View currentPage = getPageAt(curPage);
- if (shouldSetTopAlignedPivotForWidget(curPage)) {
- currentPage.setPivotY(0);
- // Note: we are working around the issue that setting the x-pivot to the same value as it
- // was does not actually work.
- currentPage.setPivotX(0);
- currentPage.setPivotX(currentPage.getMeasuredWidth() / 2);
- }
- if (!(currentPage.getScaleX() < 1f || currentPage.getScaleY() < 1f)) {
- mZoomInOutAnim = new AnimatorSet();
- mZoomInOutAnim.playTogether(
- ObjectAnimator.ofFloat(currentPage, "scaleX", BOUNCER_SCALE_FACTOR),
- ObjectAnimator.ofFloat(currentPage, "scaleY", BOUNCER_SCALE_FACTOR));
- mZoomInOutAnim.setDuration(mBouncerZoomInOutDuration);
- mZoomInOutAnim.setInterpolator(new DecelerateInterpolator(1.5f));
- mZoomInOutAnim.start();
- }
- if (currentPage instanceof KeyguardWidgetFrame) {
- ((KeyguardWidgetFrame)currentPage).onBouncerShowing(true);
- }
- }
-
- void setAddWidgetEnabled(boolean enabled) {
- if (mAddWidgetView != null && enabled) {
- addView(mAddWidgetView, 0);
- // We need to force measure the PagedView so that the calls to update the scroll
- // position below work
- measure(mLastWidthMeasureSpec, mLastHeightMeasureSpec);
- // Bump up the current page to account for the addition of the new page
- setCurrentPage(mCurrentPage + 1);
- mAddWidgetView = null;
- } else if (mAddWidgetView == null && !enabled) {
- View addWidget = findViewById(R.id.keyguard_add_widget);
- if (addWidget != null) {
- mAddWidgetView = addWidget;
- removeView(addWidget);
- }
- }
- }
-
- boolean isAddPage(int pageIndex) {
- View v = getChildAt(pageIndex);
- return v != null && v.getId() == R.id.keyguard_add_widget;
- }
-
- boolean isCameraPage(int pageIndex) {
- View v = getChildAt(pageIndex);
- return v != null && v instanceof CameraWidgetFrame;
- }
-
- @Override
- protected boolean shouldSetTopAlignedPivotForWidget(int childIndex) {
- return !isCameraPage(childIndex) && super.shouldSetTopAlignedPivotForWidget(childIndex);
- }
-
- /**
- * Search given {@link View} hierarchy for {@link TextClock} instances that
- * show various time components. Returns combination of
- * {@link #FLAG_HAS_LOCAL_HOUR} and {@link #FLAG_HAS_LOCAL_MINUTE}.
- */
- private static int findClockInHierarchy(View view) {
- if (view instanceof TextClock) {
- return getClockFlags((TextClock) view);
- } else if (view instanceof ViewGroup) {
- int flags = 0;
- final ViewGroup group = (ViewGroup) view;
- final int size = group.getChildCount();
- for (int i = 0; i < size; i++) {
- flags |= findClockInHierarchy(group.getChildAt(i));
- }
- return flags;
- } else {
- return 0;
- }
- }
-
- /**
- * Return combination of {@link #FLAG_HAS_LOCAL_HOUR} and
- * {@link #FLAG_HAS_LOCAL_MINUTE} describing the time represented described
- * by the given {@link TextClock}.
- */
- private static int getClockFlags(TextClock clock) {
- int flags = 0;
-
- final String timeZone = clock.getTimeZone();
- if (timeZone != null && !TimeZone.getDefault().equals(TimeZone.getTimeZone(timeZone))) {
- // Ignore clocks showing another timezone
- return 0;
- }
-
- final CharSequence format = clock.getFormat();
- final char hour = clock.is24HourModeEnabled() ? DateFormat.HOUR_OF_DAY
- : DateFormat.HOUR;
-
- if (DateFormat.hasDesignator(format, hour)) {
- flags |= FLAG_HAS_LOCAL_HOUR;
- }
- if (DateFormat.hasDesignator(format, DateFormat.MINUTE)) {
- flags |= FLAG_HAS_LOCAL_MINUTE;
- }
-
- return flags;
- }
-
- public void handleExternalCameraEvent(MotionEvent event) {
- beginCameraEvent();
- int cameraPage = getPageCount() - 1;
- boolean endWarp = false;
- if (isCameraPage(cameraPage) || mCameraEventInProgress) {
- switch (event.getAction()) {
- case MotionEvent.ACTION_DOWN:
- // Once we start dispatching camera events, we must continue to do so
- // to keep event dispatch happy.
- mCameraEventInProgress = true;
- userActivity();
- break;
- case MotionEvent.ACTION_UP:
- case MotionEvent.ACTION_CANCEL:
- mCameraEventInProgress = false;
- break;
- }
- dispatchTouchEvent(event);
- }
- endCameraEvent();
- }
-
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/MultiPaneChallengeLayout.java b/packages/Keyguard/src/com/android/keyguard/MultiPaneChallengeLayout.java
deleted file mode 100644
index 340a4d5..0000000
--- a/packages/Keyguard/src/com/android/keyguard/MultiPaneChallengeLayout.java
+++ /dev/null
@@ -1,575 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
-import android.content.Context;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-import android.graphics.Rect;
-import android.util.AttributeSet;
-import android.util.DisplayMetrics;
-import android.view.Gravity;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.LinearLayout;
-
-public class MultiPaneChallengeLayout extends ViewGroup implements ChallengeLayout {
- private static final String TAG = "MultiPaneChallengeLayout";
-
- final int mOrientation;
- private boolean mIsBouncing;
-
- public static final int HORIZONTAL = LinearLayout.HORIZONTAL;
- public static final int VERTICAL = LinearLayout.VERTICAL;
- public static final int ANIMATE_BOUNCE_DURATION = 350;
-
- private KeyguardSecurityContainer mChallengeView;
- private View mUserSwitcherView;
- private View mScrimView;
- private OnBouncerStateChangedListener mBouncerListener;
-
- private final Rect mTempRect = new Rect();
- private final Rect mZeroPadding = new Rect();
- private final Rect mInsets = new Rect();
-
- private final DisplayMetrics mDisplayMetrics;
-
- private final OnClickListener mScrimClickListener = new OnClickListener() {
- @Override
- public void onClick(View v) {
- hideBouncer();
- }
- };
-
- public MultiPaneChallengeLayout(Context context) {
- this(context, null);
- }
-
- public MultiPaneChallengeLayout(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public MultiPaneChallengeLayout(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
-
- final TypedArray a = context.obtainStyledAttributes(attrs,
- R.styleable.MultiPaneChallengeLayout, defStyleAttr, 0);
- mOrientation = a.getInt(R.styleable.MultiPaneChallengeLayout_android_orientation,
- HORIZONTAL);
- a.recycle();
-
- final Resources res = getResources();
- mDisplayMetrics = res.getDisplayMetrics();
-
- setSystemUiVisibility(SYSTEM_UI_FLAG_LAYOUT_STABLE | SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
- }
-
- public void setInsets(Rect insets) {
- mInsets.set(insets);
- }
-
- @Override
- public boolean isChallengeShowing() {
- return true;
- }
-
- @Override
- public boolean isChallengeOverlapping() {
- return false;
- }
-
- @Override
- public void showChallenge(boolean b) {
- }
-
- @Override
- public int getBouncerAnimationDuration() {
- return ANIMATE_BOUNCE_DURATION;
- }
-
- @Override
- public void showBouncer() {
- if (mIsBouncing) return;
- mIsBouncing = true;
- if (mScrimView != null) {
- if (mChallengeView != null) {
- mChallengeView.showBouncer(ANIMATE_BOUNCE_DURATION);
- }
-
- Animator anim = ObjectAnimator.ofFloat(mScrimView, "alpha", 1f);
- anim.setDuration(ANIMATE_BOUNCE_DURATION);
- anim.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- mScrimView.setVisibility(VISIBLE);
- }
- });
- anim.start();
- }
- if (mBouncerListener != null) {
- mBouncerListener.onBouncerStateChanged(true);
- }
- }
-
- @Override
- public void hideBouncer() {
- if (!mIsBouncing) return;
- mIsBouncing = false;
- if (mScrimView != null) {
- if (mChallengeView != null) {
- mChallengeView.hideBouncer(ANIMATE_BOUNCE_DURATION);
- }
-
- Animator anim = ObjectAnimator.ofFloat(mScrimView, "alpha", 0f);
- anim.setDuration(ANIMATE_BOUNCE_DURATION);
- anim.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mScrimView.setVisibility(INVISIBLE);
- }
- });
- anim.start();
- }
- if (mBouncerListener != null) {
- mBouncerListener.onBouncerStateChanged(false);
- }
- }
-
- @Override
- public boolean isBouncing() {
- return mIsBouncing;
- }
-
- @Override
- public void setOnBouncerStateChangedListener(OnBouncerStateChangedListener listener) {
- mBouncerListener = listener;
- }
-
- @Override
- public void requestChildFocus(View child, View focused) {
- if (mIsBouncing && child != mChallengeView) {
- // Clear out of the bouncer if the user tries to move focus outside of
- // the security challenge view.
- hideBouncer();
- }
- super.requestChildFocus(child, focused);
- }
-
- void setScrimView(View scrim) {
- if (mScrimView != null) {
- mScrimView.setOnClickListener(null);
- }
- mScrimView = scrim;
- if (mScrimView != null) {
- mScrimView.setAlpha(mIsBouncing ? 1.0f : 0.0f);
- mScrimView.setVisibility(mIsBouncing ? VISIBLE : INVISIBLE);
- mScrimView.setFocusable(true);
- mScrimView.setOnClickListener(mScrimClickListener);
- }
- }
-
- private int getVirtualHeight(LayoutParams lp, int height, int heightUsed) {
- int virtualHeight = height;
- final View root = getRootView();
- if (root != null) {
- // This calculation is super dodgy and relies on several assumptions.
- // Specifically that the root of the window will be padded in for insets
- // and that the window is LAYOUT_IN_SCREEN.
- virtualHeight = mDisplayMetrics.heightPixels - root.getPaddingTop() - mInsets.top;
- }
- if (lp.childType == LayoutParams.CHILD_TYPE_USER_SWITCHER) {
- // Always measure the user switcher as if there were no IME insets
- // on the window.
- return virtualHeight - heightUsed;
- } else if (lp.childType == LayoutParams.CHILD_TYPE_PAGE_DELETE_DROP_TARGET) {
- return height;
- }
- return Math.min(virtualHeight - heightUsed, height);
- }
-
- @Override
- protected void onMeasure(final int widthSpec, final int heightSpec) {
- if (MeasureSpec.getMode(widthSpec) != MeasureSpec.EXACTLY ||
- MeasureSpec.getMode(heightSpec) != MeasureSpec.EXACTLY) {
- throw new IllegalArgumentException(
- "MultiPaneChallengeLayout must be measured with an exact size");
- }
-
- final int width = MeasureSpec.getSize(widthSpec);
- final int height = MeasureSpec.getSize(heightSpec);
- setMeasuredDimension(width, height);
-
- final int insetHeight = height - mInsets.top - mInsets.bottom;
- final int insetHeightSpec = MeasureSpec.makeMeasureSpec(insetHeight, MeasureSpec.EXACTLY);
-
- int widthUsed = 0;
- int heightUsed = 0;
-
- // First pass. Find the challenge view and measure the user switcher,
- // which consumes space in the layout.
- mChallengeView = null;
- mUserSwitcherView = null;
- final int count = getChildCount();
- for (int i = 0; i < count; i++) {
- final View child = getChildAt(i);
- final LayoutParams lp = (LayoutParams) child.getLayoutParams();
-
- if (lp.childType == LayoutParams.CHILD_TYPE_CHALLENGE) {
- if (mChallengeView != null) {
- throw new IllegalStateException(
- "There may only be one child of type challenge");
- }
- if (!(child instanceof KeyguardSecurityContainer)) {
- throw new IllegalArgumentException(
- "Challenge must be a KeyguardSecurityContainer");
- }
- mChallengeView = (KeyguardSecurityContainer) child;
- } else if (lp.childType == LayoutParams.CHILD_TYPE_USER_SWITCHER) {
- if (mUserSwitcherView != null) {
- throw new IllegalStateException(
- "There may only be one child of type userSwitcher");
- }
- mUserSwitcherView = child;
-
- if (child.getVisibility() == GONE) continue;
-
- int adjustedWidthSpec = widthSpec;
- int adjustedHeightSpec = insetHeightSpec;
- if (lp.maxWidth >= 0) {
- adjustedWidthSpec = MeasureSpec.makeMeasureSpec(
- Math.min(lp.maxWidth, width), MeasureSpec.EXACTLY);
- }
- if (lp.maxHeight >= 0) {
- adjustedHeightSpec = MeasureSpec.makeMeasureSpec(
- Math.min(lp.maxHeight, insetHeight), MeasureSpec.EXACTLY);
- }
- // measureChildWithMargins will resolve layout direction for the LayoutParams
- measureChildWithMargins(child, adjustedWidthSpec, 0, adjustedHeightSpec, 0);
-
- // Only subtract out space from one dimension. Favor vertical.
- // Offset by 1.5x to add some balance along the other edge.
- if (Gravity.isVertical(lp.gravity)) {
- heightUsed += child.getMeasuredHeight() * 1.5f;
- } else if (Gravity.isHorizontal(lp.gravity)) {
- widthUsed += child.getMeasuredWidth() * 1.5f;
- }
- } else if (lp.childType == LayoutParams.CHILD_TYPE_SCRIM) {
- setScrimView(child);
- child.measure(widthSpec, heightSpec);
- }
- }
-
- // Second pass. Measure everything that's left.
- for (int i = 0; i < count; i++) {
- final View child = getChildAt(i);
- final LayoutParams lp = (LayoutParams) child.getLayoutParams();
-
- if (lp.childType == LayoutParams.CHILD_TYPE_USER_SWITCHER ||
- lp.childType == LayoutParams.CHILD_TYPE_SCRIM ||
- child.getVisibility() == GONE) {
- // Don't need to measure GONE children, and the user switcher was already measured.
- continue;
- }
-
- final int virtualHeight = getVirtualHeight(lp, insetHeight, heightUsed);
-
- int adjustedWidthSpec;
- int adjustedHeightSpec;
- if (lp.centerWithinArea > 0) {
- if (mOrientation == HORIZONTAL) {
- adjustedWidthSpec = MeasureSpec.makeMeasureSpec(
- (int) ((width - widthUsed) * lp.centerWithinArea + 0.5f),
- MeasureSpec.EXACTLY);
- adjustedHeightSpec = MeasureSpec.makeMeasureSpec(
- virtualHeight, MeasureSpec.EXACTLY);
- } else {
- adjustedWidthSpec = MeasureSpec.makeMeasureSpec(
- width - widthUsed, MeasureSpec.EXACTLY);
- adjustedHeightSpec = MeasureSpec.makeMeasureSpec(
- (int) (virtualHeight * lp.centerWithinArea + 0.5f),
- MeasureSpec.EXACTLY);
- }
- } else {
- adjustedWidthSpec = MeasureSpec.makeMeasureSpec(
- width - widthUsed, MeasureSpec.EXACTLY);
- adjustedHeightSpec = MeasureSpec.makeMeasureSpec(
- virtualHeight, MeasureSpec.EXACTLY);
- }
- if (lp.maxWidth >= 0) {
- adjustedWidthSpec = MeasureSpec.makeMeasureSpec(
- Math.min(lp.maxWidth, MeasureSpec.getSize(adjustedWidthSpec)),
- MeasureSpec.EXACTLY);
- }
- if (lp.maxHeight >= 0) {
- adjustedHeightSpec = MeasureSpec.makeMeasureSpec(
- Math.min(lp.maxHeight, MeasureSpec.getSize(adjustedHeightSpec)),
- MeasureSpec.EXACTLY);
- }
-
- measureChildWithMargins(child, adjustedWidthSpec, 0, adjustedHeightSpec, 0);
- }
- }
-
- @Override
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
- final Rect padding = mTempRect;
- padding.left = getPaddingLeft();
- padding.top = getPaddingTop();
- padding.right = getPaddingRight();
- padding.bottom = getPaddingBottom();
- final int width = r - l;
- final int height = b - t;
- final int insetHeight = height - mInsets.top - mInsets.bottom;
-
- // Reserve extra space in layout for the user switcher by modifying
- // local padding during this layout pass
- if (mUserSwitcherView != null && mUserSwitcherView.getVisibility() != GONE) {
- layoutWithGravity(width, insetHeight, mUserSwitcherView, padding, true);
- }
-
- final int count = getChildCount();
- for (int i = 0; i < count; i++) {
- final View child = getChildAt(i);
- LayoutParams lp = (LayoutParams) child.getLayoutParams();
-
- // We did the user switcher above if we have one.
- if (child == mUserSwitcherView || child.getVisibility() == GONE) continue;
-
- if (child == mScrimView) {
- child.layout(0, 0, width, height);
- continue;
- } else if (lp.childType == LayoutParams.CHILD_TYPE_PAGE_DELETE_DROP_TARGET) {
- layoutWithGravity(width, insetHeight, child, mZeroPadding, false);
- continue;
- }
-
- layoutWithGravity(width, insetHeight, child, padding, false);
- }
- }
-
- private void layoutWithGravity(int width, int height, View child, Rect padding,
- boolean adjustPadding) {
- final LayoutParams lp = (LayoutParams) child.getLayoutParams();
-
- final int heightUsed = padding.top + padding.bottom - getPaddingTop() - getPaddingBottom();
- height = getVirtualHeight(lp, height, heightUsed);
-
- final int gravity = Gravity.getAbsoluteGravity(lp.gravity, getLayoutDirection());
-
- final boolean fixedLayoutSize = lp.centerWithinArea > 0;
- final boolean fixedLayoutHorizontal = fixedLayoutSize && mOrientation == HORIZONTAL;
- final boolean fixedLayoutVertical = fixedLayoutSize && mOrientation == VERTICAL;
-
- final int adjustedWidth;
- final int adjustedHeight;
- if (fixedLayoutHorizontal) {
- final int paddedWidth = width - padding.left - padding.right;
- adjustedWidth = (int) (paddedWidth * lp.centerWithinArea + 0.5f);
- adjustedHeight = height;
- } else if (fixedLayoutVertical) {
- final int paddedHeight = height - getPaddingTop() - getPaddingBottom();
- adjustedWidth = width;
- adjustedHeight = (int) (paddedHeight * lp.centerWithinArea + 0.5f);
- } else {
- adjustedWidth = width;
- adjustedHeight = height;
- }
-
- final boolean isVertical = Gravity.isVertical(gravity);
- final boolean isHorizontal = Gravity.isHorizontal(gravity);
- final int childWidth = child.getMeasuredWidth();
- final int childHeight = child.getMeasuredHeight();
-
- int left = padding.left;
- int top = padding.top;
- int right = left + childWidth;
- int bottom = top + childHeight;
- switch (gravity & Gravity.VERTICAL_GRAVITY_MASK) {
- case Gravity.TOP:
- top = fixedLayoutVertical ?
- padding.top + (adjustedHeight - childHeight) / 2 : padding.top;
- bottom = top + childHeight;
- if (adjustPadding && isVertical) {
- padding.top = bottom;
- padding.bottom += childHeight / 2;
- }
- break;
- case Gravity.BOTTOM:
- bottom = fixedLayoutVertical
- ? padding.top + height - (adjustedHeight - childHeight) / 2
- : padding.top + height;
- top = bottom - childHeight;
- if (adjustPadding && isVertical) {
- padding.bottom = height - top;
- padding.top += childHeight / 2;
- }
- break;
- case Gravity.CENTER_VERTICAL:
- top = padding.top + (height - childHeight) / 2;
- bottom = top + childHeight;
- break;
- }
- switch (gravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
- case Gravity.LEFT:
- left = fixedLayoutHorizontal ?
- padding.left + (adjustedWidth - childWidth) / 2 : padding.left;
- right = left + childWidth;
- if (adjustPadding && isHorizontal && !isVertical) {
- padding.left = right;
- padding.right += childWidth / 2;
- }
- break;
- case Gravity.RIGHT:
- right = fixedLayoutHorizontal
- ? width - padding.right - (adjustedWidth - childWidth) / 2
- : width - padding.right;
- left = right - childWidth;
- if (adjustPadding && isHorizontal && !isVertical) {
- padding.right = width - left;
- padding.left += childWidth / 2;
- }
- break;
- case Gravity.CENTER_HORIZONTAL:
- final int paddedWidth = width - padding.left - padding.right;
- left = (paddedWidth - childWidth) / 2;
- right = left + childWidth;
- break;
- }
- top += mInsets.top;
- bottom += mInsets.top;
- child.layout(left, top, right, bottom);
- }
-
- @Override
- public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs) {
- return new LayoutParams(getContext(), attrs, this);
- }
-
- @Override
- protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
- return p instanceof LayoutParams ? new LayoutParams((LayoutParams) p) :
- p instanceof MarginLayoutParams ? new LayoutParams((MarginLayoutParams) p) :
- new LayoutParams(p);
- }
-
- @Override
- protected ViewGroup.LayoutParams generateDefaultLayoutParams() {
- return new LayoutParams();
- }
-
- @Override
- protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
- return p instanceof LayoutParams;
- }
-
- public static class LayoutParams extends MarginLayoutParams {
-
- public float centerWithinArea = 0;
-
- public int childType = 0;
-
- public static final int CHILD_TYPE_NONE = 0;
- public static final int CHILD_TYPE_WIDGET = 1;
- public static final int CHILD_TYPE_CHALLENGE = 2;
- public static final int CHILD_TYPE_USER_SWITCHER = 3;
- public static final int CHILD_TYPE_SCRIM = 4;
- public static final int CHILD_TYPE_PAGE_DELETE_DROP_TARGET = 7;
-
- public int gravity = Gravity.NO_GRAVITY;
-
- public int maxWidth = -1;
- public int maxHeight = -1;
-
- public LayoutParams() {
- this(WRAP_CONTENT, WRAP_CONTENT);
- }
-
- LayoutParams(Context c, AttributeSet attrs, MultiPaneChallengeLayout parent) {
- super(c, attrs);
-
- final TypedArray a = c.obtainStyledAttributes(attrs,
- R.styleable.MultiPaneChallengeLayout_Layout);
-
- centerWithinArea = a.getFloat(
- R.styleable.MultiPaneChallengeLayout_Layout_layout_centerWithinArea, 0);
- childType = a.getInt(R.styleable.MultiPaneChallengeLayout_Layout_layout_childType,
- CHILD_TYPE_NONE);
- gravity = a.getInt(R.styleable.MultiPaneChallengeLayout_Layout_layout_gravity,
- Gravity.NO_GRAVITY);
- maxWidth = a.getDimensionPixelSize(
- R.styleable.MultiPaneChallengeLayout_Layout_layout_maxWidth, -1);
- maxHeight = a.getDimensionPixelSize(
- R.styleable.MultiPaneChallengeLayout_Layout_layout_maxHeight, -1);
-
- // Default gravity settings based on type and parent orientation
- if (gravity == Gravity.NO_GRAVITY) {
- if (parent.mOrientation == HORIZONTAL) {
- switch (childType) {
- case CHILD_TYPE_WIDGET:
- gravity = Gravity.LEFT | Gravity.CENTER_VERTICAL;
- break;
- case CHILD_TYPE_CHALLENGE:
- gravity = Gravity.RIGHT | Gravity.CENTER_VERTICAL;
- break;
- case CHILD_TYPE_USER_SWITCHER:
- gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
- break;
- }
- } else {
- switch (childType) {
- case CHILD_TYPE_WIDGET:
- gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
- break;
- case CHILD_TYPE_CHALLENGE:
- gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
- break;
- case CHILD_TYPE_USER_SWITCHER:
- gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
- break;
- }
- }
- }
-
- a.recycle();
- }
-
- public LayoutParams(int width, int height) {
- super(width, height);
- }
-
- public LayoutParams(ViewGroup.LayoutParams source) {
- super(source);
- }
-
- public LayoutParams(MarginLayoutParams source) {
- super(source);
- }
-
- public LayoutParams(LayoutParams source) {
- this((MarginLayoutParams) source);
-
- centerWithinArea = source.centerWithinArea;
- childType = source.childType;
- gravity = source.gravity;
- maxWidth = source.maxWidth;
- maxHeight = source.maxHeight;
- }
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/MultiUserAvatarCache.java b/packages/Keyguard/src/com/android/keyguard/MultiUserAvatarCache.java
deleted file mode 100644
index 7128211..0000000
--- a/packages/Keyguard/src/com/android/keyguard/MultiUserAvatarCache.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import android.graphics.drawable.Drawable;
-
-import java.util.HashMap;
-
-public class MultiUserAvatarCache {
-
- private static MultiUserAvatarCache sInstance;
-
- private final HashMap<Integer, Drawable> mCache;
-
- private MultiUserAvatarCache() {
- mCache = new HashMap<Integer, Drawable>();
- }
-
- public static MultiUserAvatarCache getInstance() {
- if (sInstance == null) {
- sInstance = new MultiUserAvatarCache();
- }
- return sInstance;
- }
-
- public void clear(int userId) {
- mCache.remove(userId);
- }
-
- public Drawable get(int userId) {
- return mCache.get(userId);
- }
-
- public void put(int userId, Drawable image) {
- mCache.put(userId, image);
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/PagedView.java b/packages/Keyguard/src/com/android/keyguard/PagedView.java
deleted file mode 100644
index b42a085..0000000
--- a/packages/Keyguard/src/com/android/keyguard/PagedView.java
+++ /dev/null
@@ -1,2845 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
-import android.animation.TimeInterpolator;
-import android.animation.ValueAnimator;
-import android.animation.ValueAnimator.AnimatorUpdateListener;
-import android.content.Context;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.Matrix;
-import android.graphics.PointF;
-import android.graphics.Rect;
-import android.os.Bundle;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.util.AttributeSet;
-import android.util.DisplayMetrics;
-import android.util.Log;
-import android.view.*;
-import android.view.accessibility.AccessibilityEvent;
-import android.view.accessibility.AccessibilityManager;
-import android.view.accessibility.AccessibilityNodeInfo;
-import android.view.animation.AccelerateInterpolator;
-import android.view.animation.AnimationUtils;
-import android.view.animation.DecelerateInterpolator;
-import android.view.animation.Interpolator;
-import android.view.animation.LinearInterpolator;
-import android.widget.Scroller;
-
-import java.util.ArrayList;
-
-/**
- * An abstraction of the original Workspace which supports browsing through a
- * sequential list of "pages"
- */
-public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarchyChangeListener {
- private static final int WARP_SNAP_DURATION = 160;
- private static final String TAG = "WidgetPagedView";
- private static final boolean DEBUG = KeyguardConstants.DEBUG;
- private static final boolean DEBUG_WARP = false;
- protected static final int INVALID_PAGE = -1;
- private static final int WARP_PEEK_ANIMATION_DURATION = 150;
- private static final float WARP_ANIMATE_AMOUNT = -75.0f; // in dip
-
- // the min drag distance for a fling to register, to prevent random page shifts
- private static final int MIN_LENGTH_FOR_FLING = 25;
-
- protected static final int PAGE_SNAP_ANIMATION_DURATION = 750;
- protected static final int SLOW_PAGE_SNAP_ANIMATION_DURATION = 950;
- protected static final float NANOTIME_DIV = 1000000000.0f;
-
- private static final float OVERSCROLL_ACCELERATE_FACTOR = 2;
- private static final float OVERSCROLL_DAMP_FACTOR = 0.14f;
-
- private static final float RETURN_TO_ORIGINAL_PAGE_THRESHOLD = 0.33f;
- // The page is moved more than halfway, automatically move to the next page on touch up.
- private static final float SIGNIFICANT_MOVE_THRESHOLD = 0.5f;
-
- // The following constants need to be scaled based on density. The scaled versions will be
- // assigned to the corresponding member variables below.
- private static final int FLING_THRESHOLD_VELOCITY = 1500;
- private static final int MIN_SNAP_VELOCITY = 1500;
- private static final int MIN_FLING_VELOCITY = 500;
-
- // We are disabling touch interaction of the widget region for factory ROM.
- private static final boolean DISABLE_TOUCH_INTERACTION = false;
- private static final boolean DISABLE_TOUCH_SIDE_PAGES = true;
- private static final boolean DISABLE_FLING_TO_DELETE = false;
-
- static final int AUTOMATIC_PAGE_SPACING = -1;
-
- protected int mFlingThresholdVelocity;
- protected int mMinFlingVelocity;
- protected int mMinSnapVelocity;
-
- protected float mDensity;
- protected float mSmoothingTime;
- protected float mTouchX;
-
- protected boolean mFirstLayout = true;
-
- protected int mCurrentPage;
- protected int mChildCountOnLastMeasure;
-
- protected int mNextPage = INVALID_PAGE;
- protected int mMaxScrollX;
- protected Scroller mScroller;
- private VelocityTracker mVelocityTracker;
-
- private float mParentDownMotionX;
- private float mParentDownMotionY;
- private float mDownMotionX;
- private float mDownMotionY;
- private float mDownScrollX;
- protected float mLastMotionX;
- protected float mLastMotionXRemainder;
- protected float mLastMotionY;
- protected float mTotalMotionX;
- private int mLastScreenCenter = -1;
- private int[] mChildOffsets;
- private int[] mChildRelativeOffsets;
- private int[] mChildOffsetsWithLayoutScale;
- private String mDeleteString; // Accessibility announcement when widget is deleted
-
- protected final static int TOUCH_STATE_REST = 0;
- protected final static int TOUCH_STATE_SCROLLING = 1;
- protected final static int TOUCH_STATE_PREV_PAGE = 2;
- protected final static int TOUCH_STATE_NEXT_PAGE = 3;
- protected final static int TOUCH_STATE_REORDERING = 4;
- protected final static int TOUCH_STATE_READY = 5; // when finger is down
-
- protected final static float ALPHA_QUANTIZE_LEVEL = 0.0001f;
- protected final static float TOUCH_SLOP_SCALE = 1.0f;
-
- protected int mTouchState = TOUCH_STATE_REST;
- protected boolean mForceScreenScrolled = false;
-
- protected OnLongClickListener mLongClickListener;
-
- protected int mTouchSlop;
- private int mPagingTouchSlop;
- private int mMaximumVelocity;
- private int mMinimumWidth;
- protected int mPageSpacing;
- protected int mCellCountX = 0;
- protected int mCellCountY = 0;
- protected boolean mAllowOverScroll = true;
- protected int mUnboundedScrollX;
- protected int[] mTempVisiblePagesRange = new int[2];
- protected boolean mForceDrawAllChildrenNextFrame;
-
- // mOverScrollX is equal to getScrollX() when we're within the normal scroll range. Otherwise
- // it is equal to the scaled overscroll position. We use a separate value so as to prevent
- // the screens from continuing to translate beyond the normal bounds.
- protected int mOverScrollX;
-
- // parameter that adjusts the layout to be optimized for pages with that scale factor
- protected float mLayoutScale = 1.0f;
-
- protected static final int INVALID_POINTER = -1;
-
- protected int mActivePointerId = INVALID_POINTER;
-
- private PageSwitchListener mPageSwitchListener;
-
- protected ArrayList<Boolean> mDirtyPageContent;
-
- // If true, syncPages and syncPageItems will be called to refresh pages
- protected boolean mContentIsRefreshable = true;
-
- // If true, modify alpha of neighboring pages as user scrolls left/right
- protected boolean mFadeInAdjacentScreens = false;
-
- // It true, use a different slop parameter (pagingTouchSlop = 2 * touchSlop) for deciding
- // to switch to a new page
- protected boolean mUsePagingTouchSlop = true;
-
- // If true, the subclass should directly update scrollX itself in its computeScroll method
- // (SmoothPagedView does this)
- protected boolean mDeferScrollUpdate = false;
-
- protected boolean mIsPageMoving = false;
-
- // All syncs and layout passes are deferred until data is ready.
- protected boolean mIsDataReady = true;
-
- // Scrolling indicator
- private ValueAnimator mScrollIndicatorAnimator;
- private View mScrollIndicator;
- private int mScrollIndicatorPaddingLeft;
- private int mScrollIndicatorPaddingRight;
- private boolean mShouldShowScrollIndicator = false;
- private boolean mShouldShowScrollIndicatorImmediately = false;
- protected static final int sScrollIndicatorFadeInDuration = 150;
- protected static final int sScrollIndicatorFadeOutDuration = 650;
- protected static final int sScrollIndicatorFlashDuration = 650;
-
- // The viewport whether the pages are to be contained (the actual view may be larger than the
- // viewport)
- private Rect mViewport = new Rect();
-
- // Reordering
- // We use the min scale to determine how much to expand the actually PagedView measured
- // dimensions such that when we are zoomed out, the view is not clipped
- private int REORDERING_DROP_REPOSITION_DURATION = 200;
- protected int REORDERING_REORDER_REPOSITION_DURATION = 300;
- protected int REORDERING_ZOOM_IN_OUT_DURATION = 250;
- private int REORDERING_SIDE_PAGE_HOVER_TIMEOUT = 300;
- private float REORDERING_SIDE_PAGE_BUFFER_PERCENTAGE = 0.1f;
- private long REORDERING_DELETE_DROP_TARGET_FADE_DURATION = 150;
- private float mMinScale = 1f;
- protected View mDragView;
- protected AnimatorSet mZoomInOutAnim;
- private Runnable mSidePageHoverRunnable;
- private int mSidePageHoverIndex = -1;
- // This variable's scope is only for the duration of startReordering() and endReordering()
- private boolean mReorderingStarted = false;
- // This variable's scope is for the duration of startReordering() and after the zoomIn()
- // animation after endReordering()
- private boolean mIsReordering;
- // The runnable that settles the page after snapToPage and animateDragViewToOriginalPosition
- private int NUM_ANIMATIONS_RUNNING_BEFORE_ZOOM_OUT = 2;
- private int mPostReorderingPreZoomInRemainingAnimationCount;
- private Runnable mPostReorderingPreZoomInRunnable;
-
- // Edge swiping
- private boolean mOnlyAllowEdgeSwipes = false;
- private boolean mDownEventOnEdge = false;
- private int mEdgeSwipeRegionSize = 0;
-
- // Convenience/caching
- private Matrix mTmpInvMatrix = new Matrix();
- private float[] mTmpPoint = new float[2];
- private Rect mTmpRect = new Rect();
- private Rect mAltTmpRect = new Rect();
-
- // Fling to delete
- private int FLING_TO_DELETE_FADE_OUT_DURATION = 350;
- private float FLING_TO_DELETE_FRICTION = 0.035f;
- // The degrees specifies how much deviation from the up vector to still consider a fling "up"
- private float FLING_TO_DELETE_MAX_FLING_DEGREES = 65f;
- protected int mFlingToDeleteThresholdVelocity = -1400;
- // Drag to delete
- private boolean mDeferringForDelete = false;
- private int DELETE_SLIDE_IN_SIDE_PAGE_DURATION = 250;
- private int DRAG_TO_DELETE_FADE_OUT_DURATION = 350;
-
- // Drop to delete
- private View mDeleteDropTarget;
-
- // Bouncer
- private boolean mTopAlignPageWhenShrinkingForBouncer = false;
-
- // Page warping
- private int mPageSwapIndex = -1; // the page we swapped out if needed
- private int mPageWarpIndex = -1; // the page we intend to warp
-
- private boolean mWarpPageExposed;
- private ViewPropertyAnimator mWarpAnimation;
-
- private boolean mIsCameraEvent;
- private float mWarpPeekAmount;
- private boolean mOnPageEndWarpCalled;
- private boolean mOnPageBeginWarpCalled;
-
- public interface PageSwitchListener {
- void onPageSwitching(View newPage, int newPageIndex);
- void onPageSwitched(View newPage, int newPageIndex);
- }
-
- public PagedView(Context context) {
- this(context, null);
- }
-
- public PagedView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public PagedView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- TypedArray a = context.obtainStyledAttributes(attrs,
- R.styleable.PagedView, defStyle, 0);
- setPageSpacing(a.getDimensionPixelSize(R.styleable.PagedView_pageSpacing, 0));
- mScrollIndicatorPaddingLeft =
- a.getDimensionPixelSize(R.styleable.PagedView_scrollIndicatorPaddingLeft, 0);
- mScrollIndicatorPaddingRight =
- a.getDimensionPixelSize(R.styleable.PagedView_scrollIndicatorPaddingRight, 0);
- a.recycle();
-
- Resources r = getResources();
- mEdgeSwipeRegionSize = r.getDimensionPixelSize(R.dimen.kg_edge_swipe_region_size);
- mTopAlignPageWhenShrinkingForBouncer =
- r.getBoolean(R.bool.kg_top_align_page_shrink_on_bouncer_visible);
-
- setHapticFeedbackEnabled(false);
- init();
- }
-
- /**
- * Initializes various states for this workspace.
- */
- protected void init() {
- mDirtyPageContent = new ArrayList<Boolean>();
- mDirtyPageContent.ensureCapacity(32);
- mScroller = new Scroller(getContext(), new ScrollInterpolator());
- mCurrentPage = 0;
-
- final ViewConfiguration configuration = ViewConfiguration.get(getContext());
- mTouchSlop = configuration.getScaledTouchSlop();
- mPagingTouchSlop = configuration.getScaledPagingTouchSlop();
- mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
- mDensity = getResources().getDisplayMetrics().density;
- mWarpPeekAmount = mDensity * WARP_ANIMATE_AMOUNT;
-
- // Scale the fling-to-delete threshold by the density
- mFlingToDeleteThresholdVelocity = (int) (mFlingToDeleteThresholdVelocity * mDensity);
-
- mFlingThresholdVelocity = (int) (FLING_THRESHOLD_VELOCITY * mDensity);
- mMinFlingVelocity = (int) (MIN_FLING_VELOCITY * mDensity);
- mMinSnapVelocity = (int) (MIN_SNAP_VELOCITY * mDensity);
- setOnHierarchyChangeListener(this);
- }
-
- void setDeleteDropTarget(View v) {
- mDeleteDropTarget = v;
- }
-
- // Convenience methods to map points from self to parent and vice versa
- float[] mapPointFromViewToParent(View v, float x, float y) {
- mTmpPoint[0] = x;
- mTmpPoint[1] = y;
- v.getMatrix().mapPoints(mTmpPoint);
- mTmpPoint[0] += v.getLeft();
- mTmpPoint[1] += v.getTop();
- return mTmpPoint;
- }
- float[] mapPointFromParentToView(View v, float x, float y) {
- mTmpPoint[0] = x - v.getLeft();
- mTmpPoint[1] = y - v.getTop();
- v.getMatrix().invert(mTmpInvMatrix);
- mTmpInvMatrix.mapPoints(mTmpPoint);
- return mTmpPoint;
- }
-
- void updateDragViewTranslationDuringDrag() {
- float x = mLastMotionX - mDownMotionX + getScrollX() - mDownScrollX;
- float y = mLastMotionY - mDownMotionY;
- mDragView.setTranslationX(x);
- mDragView.setTranslationY(y);
-
- if (DEBUG) Log.d(TAG, "PagedView.updateDragViewTranslationDuringDrag(): " + x + ", " + y);
- }
-
- public void setMinScale(float f) {
- mMinScale = f;
- requestLayout();
- }
-
- @Override
- public void setScaleX(float scaleX) {
- super.setScaleX(scaleX);
- if (isReordering(true)) {
- float[] p = mapPointFromParentToView(this, mParentDownMotionX, mParentDownMotionY);
- mLastMotionX = p[0];
- mLastMotionY = p[1];
- updateDragViewTranslationDuringDrag();
- }
- }
-
- // Convenience methods to get the actual width/height of the PagedView (since it is measured
- // to be larger to account for the minimum possible scale)
- int getViewportWidth() {
- return mViewport.width();
- }
- int getViewportHeight() {
- return mViewport.height();
- }
-
- // Convenience methods to get the offset ASSUMING that we are centering the pages in the
- // PagedView both horizontally and vertically
- int getViewportOffsetX() {
- return (getMeasuredWidth() - getViewportWidth()) / 2;
- }
- int getViewportOffsetY() {
- return (getMeasuredHeight() - getViewportHeight()) / 2;
- }
-
- public void setPageSwitchListener(PageSwitchListener pageSwitchListener) {
- mPageSwitchListener = pageSwitchListener;
- if (mPageSwitchListener != null) {
- mPageSwitchListener.onPageSwitched(getPageAt(mCurrentPage), mCurrentPage);
- }
- }
-
- /**
- * Called by subclasses to mark that data is ready, and that we can begin loading and laying
- * out pages.
- */
- protected void setDataIsReady() {
- mIsDataReady = true;
- }
-
- protected boolean isDataReady() {
- return mIsDataReady;
- }
-
- /**
- * Returns the index of the currently displayed page.
- *
- * @return The index of the currently displayed page.
- */
- int getCurrentPage() {
- return mCurrentPage;
- }
-
- int getNextPage() {
- return (mNextPage != INVALID_PAGE) ? mNextPage : mCurrentPage;
- }
-
- int getPageCount() {
- return getChildCount();
- }
-
- View getPageAt(int index) {
- return getChildAt(index);
- }
-
- protected int indexToPage(int index) {
- return index;
- }
-
- /**
- * Updates the scroll of the current page immediately to its final scroll position. We use this
- * in CustomizePagedView to allow tabs to share the same PagedView while resetting the scroll of
- * the previous tab page.
- */
- protected void updateCurrentPageScroll() {
- int offset = getChildOffset(mCurrentPage);
- int relOffset = getRelativeChildOffset(mCurrentPage);
- int newX = offset - relOffset;
- scrollTo(newX, 0);
- mScroller.setFinalX(newX);
- mScroller.forceFinished(true);
- }
-
- /**
- * Sets the current page.
- */
- void setCurrentPage(int currentPage) {
- notifyPageSwitching(currentPage);
- if (!mScroller.isFinished()) {
- mScroller.abortAnimation();
- }
- // don't introduce any checks like mCurrentPage == currentPage here-- if we change the
- // the default
- if (getChildCount() == 0) {
- return;
- }
-
- mForceScreenScrolled = true;
- mCurrentPage = Math.max(0, Math.min(currentPage, getPageCount() - 1));
- updateCurrentPageScroll();
- updateScrollingIndicator();
- notifyPageSwitched();
- invalidate();
- }
-
- public void setOnlyAllowEdgeSwipes(boolean enable) {
- mOnlyAllowEdgeSwipes = enable;
- }
-
- protected void notifyPageSwitching(int whichPage) {
- if (mPageSwitchListener != null) {
- mPageSwitchListener.onPageSwitching(getPageAt(whichPage), whichPage);
- }
- }
-
- protected void notifyPageSwitched() {
- if (mPageSwitchListener != null) {
- mPageSwitchListener.onPageSwitched(getPageAt(mCurrentPage), mCurrentPage);
- }
- }
-
- protected void pageBeginMoving() {
- if (DEBUG_WARP) Log.v(TAG, "pageBeginMoving(" + mIsPageMoving + ")");
- if (!mIsPageMoving) {
- mIsPageMoving = true;
- if (isWarping()) {
- dispatchOnPageBeginWarp();
- }
- onPageBeginMoving();
- }
- }
-
- private void dispatchOnPageBeginWarp() {
- if (!mOnPageBeginWarpCalled) {
- onPageBeginWarp();
- mOnPageBeginWarpCalled = true;
- }
- mOnPageEndWarpCalled = false;
- }
-
- private void dispatchOnPageEndWarp() {
- if (!mOnPageEndWarpCalled) {
- onPageEndWarp();
- mOnPageEndWarpCalled = true;
- }
- mOnPageBeginWarpCalled = false;
- }
-
- protected void pageEndMoving() {
- if (DEBUG_WARP) Log.v(TAG, "pageEndMoving(" + mIsPageMoving + ")");
- if (mIsPageMoving) {
- mIsPageMoving = false;
- if (isWarping()) {
- dispatchOnPageEndWarp();
- mWarpPageExposed = false;
- }
- onPageEndMoving();
- }
- }
-
- protected boolean isPageMoving() {
- return mIsPageMoving;
- }
-
- // a method that subclasses can override to add behavior
- protected void onPageBeginMoving() {
- }
-
- // a method that subclasses can override to add behavior
- protected void onPageEndMoving() {
- }
-
- /**
- * Registers the specified listener on each page contained in this workspace.
- *
- * @param l The listener used to respond to long clicks.
- */
- @Override
- public void setOnLongClickListener(OnLongClickListener l) {
- mLongClickListener = l;
- final int count = getPageCount();
- for (int i = 0; i < count; i++) {
- getPageAt(i).setOnLongClickListener(l);
- }
- }
-
- @Override
- public void scrollBy(int x, int y) {
- scrollTo(mUnboundedScrollX + x, getScrollY() + y);
- }
-
- @Override
- public void scrollTo(int x, int y) {
- mUnboundedScrollX = x;
-
- if (x < 0) {
- super.scrollTo(0, y);
- if (mAllowOverScroll) {
- overScroll(x);
- }
- } else if (x > mMaxScrollX) {
- super.scrollTo(mMaxScrollX, y);
- if (mAllowOverScroll) {
- overScroll(x - mMaxScrollX);
- }
- } else {
- mOverScrollX = x;
- super.scrollTo(x, y);
- }
-
- mTouchX = x;
- mSmoothingTime = System.nanoTime() / NANOTIME_DIV;
-
- // Update the last motion events when scrolling
- if (isReordering(true)) {
- float[] p = mapPointFromParentToView(this, mParentDownMotionX, mParentDownMotionY);
- mLastMotionX = p[0];
- mLastMotionY = p[1];
- updateDragViewTranslationDuringDrag();
- }
- }
-
- // we moved this functionality to a helper function so SmoothPagedView can reuse it
- protected boolean computeScrollHelper() {
- if (mScroller.computeScrollOffset()) {
- // Don't bother scrolling if the page does not need to be moved
- if (getScrollX() != mScroller.getCurrX()
- || getScrollY() != mScroller.getCurrY()
- || mOverScrollX != mScroller.getCurrX()) {
- scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
- }
- invalidate();
- return true;
- } else if (mNextPage != INVALID_PAGE) {
- mCurrentPage = Math.max(0, Math.min(mNextPage, getPageCount() - 1));
- mNextPage = INVALID_PAGE;
- notifyPageSwitched();
-
- // We don't want to trigger a page end moving unless the page has settled
- // and the user has stopped scrolling
- if (mTouchState == TOUCH_STATE_REST) {
- pageEndMoving();
- }
-
- onPostReorderingAnimationCompleted();
- return true;
- }
- return false;
- }
-
- @Override
- public void computeScroll() {
- computeScrollHelper();
- }
-
- protected boolean shouldSetTopAlignedPivotForWidget(int childIndex) {
- return mTopAlignPageWhenShrinkingForBouncer;
- }
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- if (!mIsDataReady || getChildCount() == 0) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- return;
- }
-
- // We measure the dimensions of the PagedView to be larger than the pages so that when we
- // zoom out (and scale down), the view is still contained in the parent
- View parent = (View) getParent();
- int widthMode = MeasureSpec.getMode(widthMeasureSpec);
- int widthSize = MeasureSpec.getSize(widthMeasureSpec);
- int heightMode = MeasureSpec.getMode(heightMeasureSpec);
- int heightSize = MeasureSpec.getSize(heightMeasureSpec);
- // NOTE: We multiply by 1.5f to account for the fact that depending on the offset of the
- // viewport, we can be at most one and a half screens offset once we scale down
- DisplayMetrics dm = getResources().getDisplayMetrics();
- int maxSize = Math.max(dm.widthPixels, dm.heightPixels);
- int parentWidthSize = (int) (1.5f * maxSize);
- int parentHeightSize = maxSize;
- int scaledWidthSize = (int) (parentWidthSize / mMinScale);
- int scaledHeightSize = (int) (parentHeightSize / mMinScale);
- mViewport.set(0, 0, widthSize, heightSize);
-
- if (widthMode == MeasureSpec.UNSPECIFIED || heightMode == MeasureSpec.UNSPECIFIED) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- return;
- }
-
- // Return early if we aren't given a proper dimension
- if (widthSize <= 0 || heightSize <= 0) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- return;
- }
-
- /* Allow the height to be set as WRAP_CONTENT. This allows the particular case
- * of the All apps view on XLarge displays to not take up more space then it needs. Width
- * is still not allowed to be set as WRAP_CONTENT since many parts of the code expect
- * each page to have the same width.
- */
- final int verticalPadding = getPaddingTop() + getPaddingBottom();
- final int horizontalPadding = getPaddingLeft() + getPaddingRight();
-
- // The children are given the same width and height as the workspace
- // unless they were set to WRAP_CONTENT
- if (DEBUG) Log.d(TAG, "PagedView.onMeasure(): " + widthSize + ", " + heightSize);
- if (DEBUG) Log.d(TAG, "PagedView.scaledSize: " + scaledWidthSize + ", " + scaledHeightSize);
- if (DEBUG) Log.d(TAG, "PagedView.parentSize: " + parentWidthSize + ", " + parentHeightSize);
- if (DEBUG) Log.d(TAG, "PagedView.horizontalPadding: " + horizontalPadding);
- if (DEBUG) Log.d(TAG, "PagedView.verticalPadding: " + verticalPadding);
- final int childCount = getChildCount();
- for (int i = 0; i < childCount; i++) {
- // disallowing padding in paged view (just pass 0)
- final View child = getPageAt(i);
- final LayoutParams lp = (LayoutParams) child.getLayoutParams();
-
- int childWidthMode;
- if (lp.width == LayoutParams.WRAP_CONTENT) {
- childWidthMode = MeasureSpec.AT_MOST;
- } else {
- childWidthMode = MeasureSpec.EXACTLY;
- }
-
- int childHeightMode;
- if (lp.height == LayoutParams.WRAP_CONTENT) {
- childHeightMode = MeasureSpec.AT_MOST;
- } else {
- childHeightMode = MeasureSpec.EXACTLY;
- }
-
- final int childWidthMeasureSpec =
- MeasureSpec.makeMeasureSpec(widthSize - horizontalPadding, childWidthMode);
- final int childHeightMeasureSpec =
- MeasureSpec.makeMeasureSpec(heightSize - verticalPadding, childHeightMode);
-
- child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
- }
- setMeasuredDimension(scaledWidthSize, scaledHeightSize);
-
- // We can't call getChildOffset/getRelativeChildOffset until we set the measured dimensions.
- // We also wait until we set the measured dimensions before flushing the cache as well, to
- // ensure that the cache is filled with good values.
- invalidateCachedOffsets();
-
- if (mChildCountOnLastMeasure != getChildCount() && !mDeferringForDelete) {
- setCurrentPage(mCurrentPage);
- }
- mChildCountOnLastMeasure = getChildCount();
-
- if (childCount > 0) {
- if (DEBUG) Log.d(TAG, "getRelativeChildOffset(): " + getViewportWidth() + ", "
- + getChildWidth(0));
-
- // Calculate the variable page spacing if necessary
- if (mPageSpacing == AUTOMATIC_PAGE_SPACING) {
- // The gap between pages in the PagedView should be equal to the gap from the page
- // to the edge of the screen (so it is not visible in the current screen). To
- // account for unequal padding on each side of the paged view, we take the maximum
- // of the left/right gap and use that as the gap between each page.
- int offset = getRelativeChildOffset(0);
- int spacing = Math.max(offset, widthSize - offset -
- getChildAt(0).getMeasuredWidth());
- setPageSpacing(spacing);
- }
- }
-
- updateScrollingIndicatorPosition();
-
- if (childCount > 0) {
- mMaxScrollX = getChildOffset(childCount - 1) - getRelativeChildOffset(childCount - 1);
- } else {
- mMaxScrollX = 0;
- }
- }
-
- public void setPageSpacing(int pageSpacing) {
- mPageSpacing = pageSpacing;
- invalidateCachedOffsets();
- }
-
- @Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- if (!mIsDataReady || getChildCount() == 0) {
- return;
- }
-
- if (DEBUG) Log.d(TAG, "PagedView.onLayout()");
- final int childCount = getChildCount();
-
- int offsetX = getViewportOffsetX();
- int offsetY = getViewportOffsetY();
-
- // Update the viewport offsets
- mViewport.offset(offsetX, offsetY);
-
- int childLeft = offsetX + getRelativeChildOffset(0);
- for (int i = 0; i < childCount; i++) {
- final View child = getPageAt(i);
- int childTop = offsetY + getPaddingTop();
- if (child.getVisibility() != View.GONE) {
- final int childWidth = getScaledMeasuredWidth(child);
- final int childHeight = child.getMeasuredHeight();
-
- if (DEBUG) Log.d(TAG, "\tlayout-child" + i + ": " + childLeft + ", " + childTop);
- child.layout(childLeft, childTop,
- childLeft + child.getMeasuredWidth(), childTop + childHeight);
- childLeft += childWidth + mPageSpacing;
- }
- }
-
- if (mFirstLayout && mCurrentPage >= 0 && mCurrentPage < getChildCount()) {
- setHorizontalScrollBarEnabled(false);
- updateCurrentPageScroll();
- setHorizontalScrollBarEnabled(true);
- mFirstLayout = false;
- }
- }
-
- protected void screenScrolled(int screenCenter) {
- }
-
- @Override
- public void onChildViewAdded(View parent, View child) {
- // This ensures that when children are added, they get the correct transforms / alphas
- // in accordance with any scroll effects.
- mForceScreenScrolled = true;
- invalidate();
- invalidateCachedOffsets();
- }
-
- @Override
- public void onChildViewRemoved(View parent, View child) {
- mForceScreenScrolled = true;
- invalidate();
- invalidateCachedOffsets();
- }
-
- protected void invalidateCachedOffsets() {
- int count = getChildCount();
- if (count == 0) {
- mChildOffsets = null;
- mChildRelativeOffsets = null;
- mChildOffsetsWithLayoutScale = null;
- return;
- }
-
- mChildOffsets = new int[count];
- mChildRelativeOffsets = new int[count];
- mChildOffsetsWithLayoutScale = new int[count];
- for (int i = 0; i < count; i++) {
- mChildOffsets[i] = -1;
- mChildRelativeOffsets[i] = -1;
- mChildOffsetsWithLayoutScale[i] = -1;
- }
- }
-
- protected int getChildOffset(int index) {
- if (index < 0 || index > getChildCount() - 1) return 0;
-
- int[] childOffsets = Float.compare(mLayoutScale, 1f) == 0 ?
- mChildOffsets : mChildOffsetsWithLayoutScale;
-
- if (childOffsets != null && childOffsets[index] != -1) {
- return childOffsets[index];
- } else {
- if (getChildCount() == 0)
- return 0;
-
- int offset = getRelativeChildOffset(0);
- for (int i = 0; i < index; ++i) {
- offset += getScaledMeasuredWidth(getPageAt(i)) + mPageSpacing;
- }
- if (childOffsets != null) {
- childOffsets[index] = offset;
- }
- return offset;
- }
- }
-
- protected int getRelativeChildOffset(int index) {
- if (index < 0 || index > getChildCount() - 1) return 0;
-
- if (mChildRelativeOffsets != null && mChildRelativeOffsets[index] != -1) {
- return mChildRelativeOffsets[index];
- } else {
- final int padding = getPaddingLeft() + getPaddingRight();
- final int offset = getPaddingLeft() +
- (getViewportWidth() - padding - getChildWidth(index)) / 2;
- if (mChildRelativeOffsets != null) {
- mChildRelativeOffsets[index] = offset;
- }
- return offset;
- }
- }
-
- protected int getScaledMeasuredWidth(View child) {
- // This functions are called enough times that it actually makes a difference in the
- // profiler -- so just inline the max() here
- final int measuredWidth = child.getMeasuredWidth();
- final int minWidth = mMinimumWidth;
- final int maxWidth = (minWidth > measuredWidth) ? minWidth : measuredWidth;
- return (int) (maxWidth * mLayoutScale + 0.5f);
- }
-
- void boundByReorderablePages(boolean isReordering, int[] range) {
- // Do nothing
- }
-
- // TODO: Fix this
- protected void getVisiblePages(int[] range) {
- range[0] = 0;
- range[1] = getPageCount() - 1;
-
- /*
- final int pageCount = getChildCount();
-
- if (pageCount > 0) {
- final int screenWidth = getViewportWidth();
- int leftScreen = 0;
- int rightScreen = 0;
- int offsetX = getViewportOffsetX() + getScrollX();
- View currPage = getPageAt(leftScreen);
- while (leftScreen < pageCount - 1 &&
- currPage.getX() + currPage.getWidth() -
- currPage.getPaddingRight() < offsetX) {
- leftScreen++;
- currPage = getPageAt(leftScreen);
- }
- rightScreen = leftScreen;
- currPage = getPageAt(rightScreen + 1);
- while (rightScreen < pageCount - 1 &&
- currPage.getX() - currPage.getPaddingLeft() < offsetX + screenWidth) {
- rightScreen++;
- currPage = getPageAt(rightScreen + 1);
- }
-
- // TEMP: this is a hacky way to ensure that animations to new pages are not clipped
- // because we don't draw them while scrolling?
- range[0] = Math.max(0, leftScreen - 1);
- range[1] = Math.min(rightScreen + 1, getChildCount() - 1);
- } else {
- range[0] = -1;
- range[1] = -1;
- }
- */
- }
-
- protected boolean shouldDrawChild(View child) {
- return child.getAlpha() > 0;
- }
-
- @Override
- protected void dispatchDraw(Canvas canvas) {
- int halfScreenSize = getViewportWidth() / 2;
- // mOverScrollX is equal to getScrollX() when we're within the normal scroll range.
- // Otherwise it is equal to the scaled overscroll position.
- int screenCenter = mOverScrollX + halfScreenSize;
-
- if (screenCenter != mLastScreenCenter || mForceScreenScrolled) {
- // set mForceScreenScrolled before calling screenScrolled so that screenScrolled can
- // set it for the next frame
- mForceScreenScrolled = false;
- screenScrolled(screenCenter);
- mLastScreenCenter = screenCenter;
- }
-
- // Find out which screens are visible; as an optimization we only call draw on them
- final int pageCount = getChildCount();
- if (pageCount > 0) {
- getVisiblePages(mTempVisiblePagesRange);
- final int leftScreen = mTempVisiblePagesRange[0];
- final int rightScreen = mTempVisiblePagesRange[1];
- if (leftScreen != -1 && rightScreen != -1) {
- final long drawingTime = getDrawingTime();
- // Clip to the bounds
- canvas.save();
- canvas.clipRect(getScrollX(), getScrollY(), getScrollX() + getRight() - getLeft(),
- getScrollY() + getBottom() - getTop());
-
- // Draw all the children, leaving the drag view for last
- for (int i = pageCount - 1; i >= 0; i--) {
- final View v = getPageAt(i);
- if (v == mDragView) continue;
- if (mForceDrawAllChildrenNextFrame ||
- (leftScreen <= i && i <= rightScreen && shouldDrawChild(v))) {
- drawChild(canvas, v, drawingTime);
- }
- }
- // Draw the drag view on top (if there is one)
- if (mDragView != null) {
- drawChild(canvas, mDragView, drawingTime);
- }
-
- mForceDrawAllChildrenNextFrame = false;
- canvas.restore();
- }
- }
- }
-
- @Override
- public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
- int page = indexToPage(indexOfChild(child));
- if (page != mCurrentPage || !mScroller.isFinished()) {
- snapToPage(page);
- return true;
- }
- return false;
- }
-
- @Override
- protected boolean onRequestFocusInDescendants(int direction, Rect previouslyFocusedRect) {
- int focusablePage;
- if (mNextPage != INVALID_PAGE) {
- focusablePage = mNextPage;
- } else {
- focusablePage = mCurrentPage;
- }
- View v = getPageAt(focusablePage);
- if (v != null) {
- return v.requestFocus(direction, previouslyFocusedRect);
- }
- return false;
- }
-
- @Override
- public boolean dispatchUnhandledMove(View focused, int direction) {
- if (direction == View.FOCUS_LEFT) {
- if (getCurrentPage() > 0) {
- snapToPage(getCurrentPage() - 1);
- return true;
- }
- } else if (direction == View.FOCUS_RIGHT) {
- if (getCurrentPage() < getPageCount() - 1) {
- snapToPage(getCurrentPage() + 1);
- return true;
- }
- }
- return super.dispatchUnhandledMove(focused, direction);
- }
-
- @Override
- public void addFocusables(ArrayList<View> views, int direction, int focusableMode) {
- if (mCurrentPage >= 0 && mCurrentPage < getPageCount()) {
- getPageAt(mCurrentPage).addFocusables(views, direction, focusableMode);
- }
- if (direction == View.FOCUS_LEFT) {
- if (mCurrentPage > 0) {
- getPageAt(mCurrentPage - 1).addFocusables(views, direction, focusableMode);
- }
- } else if (direction == View.FOCUS_RIGHT){
- if (mCurrentPage < getPageCount() - 1) {
- getPageAt(mCurrentPage + 1).addFocusables(views, direction, focusableMode);
- }
- }
- }
-
- /**
- * If one of our descendant views decides that it could be focused now, only
- * pass that along if it's on the current page.
- *
- * This happens when live folders requery, and if they're off page, they
- * end up calling requestFocus, which pulls it on page.
- */
- @Override
- public void focusableViewAvailable(View focused) {
- View current = getPageAt(mCurrentPage);
- View v = focused;
- while (true) {
- if (v == current) {
- super.focusableViewAvailable(focused);
- return;
- }
- if (v == this) {
- return;
- }
- ViewParent parent = v.getParent();
- if (parent instanceof View) {
- v = (View)v.getParent();
- } else {
- return;
- }
- }
- }
-
- /**
- * Return true if a tap at (x, y) should trigger a flip to the previous page.
- */
- protected boolean hitsPreviousPage(float x, float y) {
- return (x < getViewportOffsetX() + getRelativeChildOffset(mCurrentPage) - mPageSpacing);
- }
-
- /**
- * Return true if a tap at (x, y) should trigger a flip to the next page.
- */
- protected boolean hitsNextPage(float x, float y) {
- return (x > (getViewportOffsetX() + getViewportWidth() - getRelativeChildOffset(mCurrentPage) + mPageSpacing));
- }
-
- /** Returns whether x and y originated within the buffered viewport */
- private boolean isTouchPointInViewportWithBuffer(int x, int y) {
- mTmpRect.set(mViewport.left - mViewport.width() / 2, mViewport.top,
- mViewport.right + mViewport.width() / 2, mViewport.bottom);
- return mTmpRect.contains(x, y);
- }
-
- /** Returns whether x and y originated within the current page view bounds */
- private boolean isTouchPointInCurrentPage(int x, int y) {
- View v = getPageAt(getCurrentPage());
- if (v != null) {
- mTmpRect.set((v.getLeft() - getScrollX()), 0, (v.getRight() - getScrollX()),
- v.getBottom());
- return mTmpRect.contains(x, y);
- }
- return false;
- }
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (DISABLE_TOUCH_INTERACTION) {
- return false;
- }
-
- /*
- * This method JUST determines whether we want to intercept the motion.
- * If we return true, onTouchEvent will be called and we do the actual
- * scrolling there.
- */
- acquireVelocityTrackerAndAddMovement(ev);
-
- // Skip touch handling if there are no pages to swipe
- if (getChildCount() <= 0) return super.onInterceptTouchEvent(ev);
-
- /*
- * Shortcut the most recurring case: the user is in the dragging
- * state and he is moving his finger. We want to intercept this
- * motion.
- */
- final int action = ev.getAction();
- if ((action == MotionEvent.ACTION_MOVE) &&
- (mTouchState == TOUCH_STATE_SCROLLING)) {
- return true;
- }
-
- switch (action & MotionEvent.ACTION_MASK) {
- case MotionEvent.ACTION_MOVE: {
- /*
- * mIsBeingDragged == false, otherwise the shortcut would have caught it. Check
- * whether the user has moved far enough from his original down touch.
- */
- if (mActivePointerId != INVALID_POINTER) {
- if (mIsCameraEvent || determineScrollingStart(ev)) {
- startScrolling(ev);
- }
- break;
- }
- // if mActivePointerId is INVALID_POINTER, then we must have missed an ACTION_DOWN
- // event. in that case, treat the first occurence of a move event as a ACTION_DOWN
- // i.e. fall through to the next case (don't break)
- // (We sometimes miss ACTION_DOWN events in Workspace because it ignores all events
- // while it's small- this was causing a crash before we checked for INVALID_POINTER)
-
- break;
- }
-
- case MotionEvent.ACTION_DOWN: {
- if (mIsCameraEvent) {
- animateWarpPageOnScreen("interceptTouch(): DOWN");
- }
- // Remember where the motion event started
- saveDownState(ev);
-
- /*
- * If being flinged and user touches the screen, initiate drag;
- * otherwise don't. mScroller.isFinished should be false when
- * being flinged.
- */
- final int xDist = Math.abs(mScroller.getFinalX() - mScroller.getCurrX());
- final boolean finishedScrolling = (mScroller.isFinished() || xDist < mTouchSlop);
- if (finishedScrolling) {
- setTouchState(TOUCH_STATE_REST);
- mScroller.abortAnimation();
- } else {
- if (mIsCameraEvent || isTouchPointInViewportWithBuffer(
- (int) mDownMotionX, (int) mDownMotionY)) {
- setTouchState(TOUCH_STATE_SCROLLING);
- } else {
- setTouchState(TOUCH_STATE_REST);
- }
- }
-
- // check if this can be the beginning of a tap on the side of the pages
- // to scroll the current page
- if (!DISABLE_TOUCH_SIDE_PAGES) {
- if (mTouchState != TOUCH_STATE_PREV_PAGE
- && mTouchState != TOUCH_STATE_NEXT_PAGE) {
- if (getChildCount() > 0) {
- float x = ev.getX();
- float y = ev.getY();
- if (hitsPreviousPage(x, y)) {
- setTouchState(TOUCH_STATE_PREV_PAGE);
- } else if (hitsNextPage(x, y)) {
- setTouchState(TOUCH_STATE_NEXT_PAGE);
- }
- }
- }
- }
- break;
- }
-
- case MotionEvent.ACTION_UP:
- case MotionEvent.ACTION_CANCEL:
- resetTouchState();
- // Just intercept the touch event on up if we tap outside the strict viewport
- if (!isTouchPointInCurrentPage((int) mLastMotionX, (int) mLastMotionY)) {
- return true;
- }
- break;
-
- case MotionEvent.ACTION_POINTER_UP:
- onSecondaryPointerUp(ev);
- releaseVelocityTracker();
- break;
- }
-
- /*
- * The only time we want to intercept motion events is if we are in the
- * drag mode.
- */
- return mTouchState != TOUCH_STATE_REST;
- }
-
- private void setTouchState(int touchState) {
- if (mTouchState != touchState) {
- if (DEBUG_WARP) Log.v(TAG, "mTouchState changing to " + touchState);
- onTouchStateChanged(touchState);
- mTouchState = touchState;
- }
- }
-
- void onTouchStateChanged(int newTouchState) {
- if (DEBUG) {
- Log.v(TAG, "onTouchStateChanged(old="+ mTouchState + ", new=" + newTouchState + ")");
- }
- }
-
- /**
- * Save the state when we get {@link MotionEvent#ACTION_DOWN}
- * @param ev
- */
- private void saveDownState(MotionEvent ev) {
- // Remember where the motion event started
- mDownMotionX = mLastMotionX = ev.getX();
- mDownMotionY = mLastMotionY = ev.getY();
- mDownScrollX = getScrollX();
- float[] p = mapPointFromViewToParent(this, mLastMotionX, mLastMotionY);
- mParentDownMotionX = p[0];
- mParentDownMotionY = p[1];
- mLastMotionXRemainder = 0;
- mTotalMotionX = 0;
- mActivePointerId = ev.getPointerId(0);
-
- // Determine if the down event is within the threshold to be an edge swipe
- int leftEdgeBoundary = getViewportOffsetX() + mEdgeSwipeRegionSize;
- int rightEdgeBoundary = getMeasuredWidth() - getViewportOffsetX() - mEdgeSwipeRegionSize;
- if ((mDownMotionX <= leftEdgeBoundary || mDownMotionX >= rightEdgeBoundary)) {
- mDownEventOnEdge = true;
- }
- }
-
- private boolean isHorizontalCameraScroll(MotionEvent ev) {
- // Disallow scrolling if we don't have a valid pointer index
- final int pointerIndex = ev.findPointerIndex(mActivePointerId);
- if (pointerIndex == -1) return false;
-
- // If we're only allowing edge swipes, we break out early if the down event wasn't
- // at the edge.
- if (mOnlyAllowEdgeSwipes && !mDownEventOnEdge) return false;
-
- final float x = ev.getX(pointerIndex);
- final int xDiff = (int) Math.abs(x - mDownMotionX);
-
- final int touchSlop = Math.round(TOUCH_SLOP_SCALE * mTouchSlop);
- boolean xPaged = xDiff > mPagingTouchSlop;
- boolean xMoved = xDiff > touchSlop;
-
- return mIsCameraEvent && (mUsePagingTouchSlop ? xPaged : xMoved);
- }
-
- /*
- * Determines if we should change the touch state to start scrolling after the
- * user moves their touch point too far.
- */
- protected boolean determineScrollingStart(MotionEvent ev) {
- // Disallow scrolling if we don't have a valid pointer index
- final int pointerIndex = ev.findPointerIndex(mActivePointerId);
- if (pointerIndex == -1) return false;
-
- // Disallow scrolling if we started the gesture from outside the viewport
- final float x = ev.getX(pointerIndex);
- final float y = ev.getY(pointerIndex);
- if (!isTouchPointInViewportWithBuffer((int) x, (int) y)) return false;
-
- // If we're only allowing edge swipes, we break out early if the down event wasn't
- // at the edge.
- if (mOnlyAllowEdgeSwipes && !mDownEventOnEdge) return false;
-
- final int xDiff = (int) Math.abs(x - mLastMotionX);
-
- final int touchSlop = Math.round(TOUCH_SLOP_SCALE * mTouchSlop);
- boolean xPaged = xDiff > mPagingTouchSlop;
- boolean xMoved = xDiff > touchSlop;
-
- return mUsePagingTouchSlop ? xPaged : xMoved;
- }
-
- private void startScrolling(MotionEvent ev) {
- // Ignore if we don't have a valid pointer index
- final int pointerIndex = ev.findPointerIndex(mActivePointerId);
- if (pointerIndex == -1) return;
-
- final float x = ev.getX(pointerIndex);
- setTouchState(TOUCH_STATE_SCROLLING);
- mTotalMotionX += Math.abs(mLastMotionX - x);
- mLastMotionX = x;
- mLastMotionXRemainder = 0;
- mTouchX = getViewportOffsetX() + getScrollX();
- mSmoothingTime = System.nanoTime() / NANOTIME_DIV;
- pageBeginMoving();
- }
-
- protected float getMaxScrollProgress() {
- return 1.0f;
- }
-
- protected float getBoundedScrollProgress(int screenCenter, View v, int page) {
- final int halfScreenSize = getViewportWidth() / 2;
-
- screenCenter = Math.min(mScrollX + halfScreenSize, screenCenter);
- screenCenter = Math.max(halfScreenSize, screenCenter);
-
- return getScrollProgress(screenCenter, v, page);
- }
-
- protected float getScrollProgress(int screenCenter, View v, int page) {
- final int halfScreenSize = getViewportWidth() / 2;
-
- int totalDistance = getScaledMeasuredWidth(v) + mPageSpacing;
- int delta = screenCenter - (getChildOffset(page) -
- getRelativeChildOffset(page) + halfScreenSize);
-
- float scrollProgress = delta / (totalDistance * 1.0f);
- scrollProgress = Math.min(scrollProgress, getMaxScrollProgress());
- scrollProgress = Math.max(scrollProgress, - getMaxScrollProgress());
- return scrollProgress;
- }
-
- // This curve determines how the effect of scrolling over the limits of the page dimishes
- // as the user pulls further and further from the bounds
- private float overScrollInfluenceCurve(float f) {
- f -= 1.0f;
- return f * f * f + 1.0f;
- }
-
- protected void acceleratedOverScroll(float amount) {
- int screenSize = getViewportWidth();
-
- // We want to reach the max over scroll effect when the user has
- // over scrolled half the size of the screen
- float f = OVERSCROLL_ACCELERATE_FACTOR * (amount / screenSize);
-
- if (f == 0) return;
-
- // Clamp this factor, f, to -1 < f < 1
- if (Math.abs(f) >= 1) {
- f /= Math.abs(f);
- }
-
- int overScrollAmount = (int) Math.round(f * screenSize);
- if (amount < 0) {
- mOverScrollX = overScrollAmount;
- super.scrollTo(0, getScrollY());
- } else {
- mOverScrollX = mMaxScrollX + overScrollAmount;
- super.scrollTo(mMaxScrollX, getScrollY());
- }
- invalidate();
- }
-
- protected void dampedOverScroll(float amount) {
- int screenSize = getViewportWidth();
-
- float f = (amount / screenSize);
-
- if (f == 0) return;
- f = f / (Math.abs(f)) * (overScrollInfluenceCurve(Math.abs(f)));
-
- // Clamp this factor, f, to -1 < f < 1
- if (Math.abs(f) >= 1) {
- f /= Math.abs(f);
- }
-
- int overScrollAmount = (int) Math.round(OVERSCROLL_DAMP_FACTOR * f * screenSize);
- if (amount < 0) {
- mOverScrollX = overScrollAmount;
- super.scrollTo(0, getScrollY());
- } else {
- mOverScrollX = mMaxScrollX + overScrollAmount;
- super.scrollTo(mMaxScrollX, getScrollY());
- }
- invalidate();
- }
-
- protected void overScroll(float amount) {
- dampedOverScroll(amount);
- }
-
- protected float maxOverScroll() {
- // Using the formula in overScroll, assuming that f = 1.0 (which it should generally not
- // exceed). Used to find out how much extra wallpaper we need for the over scroll effect
- float f = 1.0f;
- f = f / (Math.abs(f)) * (overScrollInfluenceCurve(Math.abs(f)));
- return OVERSCROLL_DAMP_FACTOR * f;
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- if (DISABLE_TOUCH_INTERACTION) {
- return false;
- }
-
- // Skip touch handling if there are no pages to swipe
- if (getChildCount() <= 0) return super.onTouchEvent(ev);
-
- acquireVelocityTrackerAndAddMovement(ev);
-
- final int action = ev.getAction();
-
- switch (action & MotionEvent.ACTION_MASK) {
- case MotionEvent.ACTION_DOWN:
- /*
- * If being flinged and user touches, stop the fling. isFinished
- * will be false if being flinged.
- */
- if (!mScroller.isFinished()) {
- mScroller.abortAnimation();
- }
-
- // Remember where the motion event started
- saveDownState(ev);
-
- if (mTouchState == TOUCH_STATE_SCROLLING) {
- pageBeginMoving();
- } else {
- setTouchState(TOUCH_STATE_READY);
- }
-
- if (mIsCameraEvent) {
- animateWarpPageOnScreen("onTouch(): DOWN");
- }
- break;
-
- case MotionEvent.ACTION_MOVE:
- if (mTouchState == TOUCH_STATE_SCROLLING) {
- // Scroll to follow the motion event
- final int pointerIndex = ev.findPointerIndex(mActivePointerId);
-
- if (pointerIndex == -1) return true;
-
- final float x = ev.getX(pointerIndex);
- final float deltaX = mLastMotionX + mLastMotionXRemainder - x;
-
- mTotalMotionX += Math.abs(deltaX);
-
- // Only scroll and update mLastMotionX if we have moved some discrete amount. We
- // keep the remainder because we are actually testing if we've moved from the last
- // scrolled position (which is discrete).
- if (Math.abs(deltaX) >= 1.0f) {
- mTouchX += deltaX;
- mSmoothingTime = System.nanoTime() / NANOTIME_DIV;
- if (isWarping()) {
- KeyguardWidgetFrame v = (KeyguardWidgetFrame) getPageAt(getPageWarpIndex());
- v.setTranslationX(v.getTranslationX() - deltaX);
- } else if (!mDeferScrollUpdate) {
- scrollBy((int) deltaX, 0);
- if (DEBUG) Log.d(TAG, "onTouchEvent().Scrolling: " + deltaX);
- } else {
- invalidate();
- }
- mLastMotionX = x;
- mLastMotionXRemainder = deltaX - (int) deltaX;
- } else {
- awakenScrollBars();
- }
- } else if (mTouchState == TOUCH_STATE_REORDERING) {
- // Update the last motion position
- mLastMotionX = ev.getX();
- mLastMotionY = ev.getY();
-
- // Update the parent down so that our zoom animations take this new movement into
- // account
- float[] pt = mapPointFromViewToParent(this, mLastMotionX, mLastMotionY);
- mParentDownMotionX = pt[0];
- mParentDownMotionY = pt[1];
- updateDragViewTranslationDuringDrag();
-
- // Find the closest page to the touch point
- final int dragViewIndex = indexOfChild(mDragView);
- int bufferSize = (int) (REORDERING_SIDE_PAGE_BUFFER_PERCENTAGE *
- getViewportWidth());
- int leftBufferEdge = (int) (mapPointFromViewToParent(this, mViewport.left, 0)[0]
- + bufferSize);
- int rightBufferEdge = (int) (mapPointFromViewToParent(this, mViewport.right, 0)[0]
- - bufferSize);
-
- // Change the drag view if we are hovering over the drop target
- boolean isHoveringOverDelete = isHoveringOverDeleteDropTarget(
- (int) mParentDownMotionX, (int) mParentDownMotionY);
- setPageHoveringOverDeleteDropTarget(dragViewIndex, isHoveringOverDelete);
-
- if (DEBUG) Log.d(TAG, "leftBufferEdge: " + leftBufferEdge);
- if (DEBUG) Log.d(TAG, "rightBufferEdge: " + rightBufferEdge);
- if (DEBUG) Log.d(TAG, "mLastMotionX: " + mLastMotionX);
- if (DEBUG) Log.d(TAG, "mLastMotionY: " + mLastMotionY);
- if (DEBUG) Log.d(TAG, "mParentDownMotionX: " + mParentDownMotionX);
- if (DEBUG) Log.d(TAG, "mParentDownMotionY: " + mParentDownMotionY);
-
- float parentX = mParentDownMotionX;
- int pageIndexToSnapTo = -1;
- if (parentX < leftBufferEdge && dragViewIndex > 0) {
- pageIndexToSnapTo = dragViewIndex - 1;
- } else if (parentX > rightBufferEdge && dragViewIndex < getChildCount() - 1) {
- pageIndexToSnapTo = dragViewIndex + 1;
- }
-
- final int pageUnderPointIndex = pageIndexToSnapTo;
- if (pageUnderPointIndex > -1 && !isHoveringOverDelete) {
- mTempVisiblePagesRange[0] = 0;
- mTempVisiblePagesRange[1] = getPageCount() - 1;
- boundByReorderablePages(true, mTempVisiblePagesRange);
- if (mTempVisiblePagesRange[0] <= pageUnderPointIndex &&
- pageUnderPointIndex <= mTempVisiblePagesRange[1] &&
- pageUnderPointIndex != mSidePageHoverIndex && mScroller.isFinished()) {
- mSidePageHoverIndex = pageUnderPointIndex;
- mSidePageHoverRunnable = new Runnable() {
- @Override
- public void run() {
- // Update the down scroll position to account for the fact that the
- // current page is moved
- mDownScrollX = getChildOffset(pageUnderPointIndex)
- - getRelativeChildOffset(pageUnderPointIndex);
-
- // Setup the scroll to the correct page before we swap the views
- snapToPage(pageUnderPointIndex);
-
- // For each of the pages between the paged view and the drag view,
- // animate them from the previous position to the new position in
- // the layout (as a result of the drag view moving in the layout)
- int shiftDelta = (dragViewIndex < pageUnderPointIndex) ? -1 : 1;
- int lowerIndex = (dragViewIndex < pageUnderPointIndex) ?
- dragViewIndex + 1 : pageUnderPointIndex;
- int upperIndex = (dragViewIndex > pageUnderPointIndex) ?
- dragViewIndex - 1 : pageUnderPointIndex;
- for (int i = lowerIndex; i <= upperIndex; ++i) {
- View v = getChildAt(i);
- // dragViewIndex < pageUnderPointIndex, so after we remove the
- // drag view all subsequent views to pageUnderPointIndex will
- // shift down.
- int oldX = getViewportOffsetX() + getChildOffset(i);
- int newX = getViewportOffsetX() + getChildOffset(i + shiftDelta);
-
- // Animate the view translation from its old position to its new
- // position
- AnimatorSet anim = (AnimatorSet) v.getTag();
- if (anim != null) {
- anim.cancel();
- }
-
- v.setTranslationX(oldX - newX);
- anim = new AnimatorSet();
- anim.setDuration(REORDERING_REORDER_REPOSITION_DURATION);
- anim.playTogether(
- ObjectAnimator.ofFloat(v, "translationX", 0f));
- anim.start();
- v.setTag(anim);
- }
-
- removeView(mDragView);
- onRemoveView(mDragView, false);
- addView(mDragView, pageUnderPointIndex);
- onAddView(mDragView, pageUnderPointIndex);
- mSidePageHoverIndex = -1;
- }
- };
- postDelayed(mSidePageHoverRunnable, REORDERING_SIDE_PAGE_HOVER_TIMEOUT);
- }
- } else {
- removeCallbacks(mSidePageHoverRunnable);
- mSidePageHoverIndex = -1;
- }
- } else if (determineScrollingStart(ev)) {
- startScrolling(ev);
- } else if (isHorizontalCameraScroll(ev)) {
- startScrolling(ev);
- // we need to cancel the camera animation
- KeyguardWidgetFrame v = (KeyguardWidgetFrame) getPageAt(getPageWarpIndex());
- v.animate().cancel();
- }
- break;
-
- case MotionEvent.ACTION_UP:
- if (mTouchState == TOUCH_STATE_SCROLLING) {
- final int activePointerId = mActivePointerId;
- final int pointerIndex = ev.findPointerIndex(activePointerId);
-
- if (pointerIndex == -1) return true;
-
- final float x = ev.getX(pointerIndex);
- final VelocityTracker velocityTracker = mVelocityTracker;
- velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
- int velocityX = (int) velocityTracker.getXVelocity(activePointerId);
- final int deltaX = (int) (x - mDownMotionX);
- final int pageWidth = getScaledMeasuredWidth(getPageAt(mCurrentPage));
- boolean isSignificantMove = Math.abs(deltaX) > pageWidth *
- SIGNIFICANT_MOVE_THRESHOLD;
-
- mTotalMotionX += Math.abs(mLastMotionX + mLastMotionXRemainder - x);
-
- boolean isFling = mTotalMotionX > MIN_LENGTH_FOR_FLING &&
- Math.abs(velocityX) > mFlingThresholdVelocity;
-
- // In the case that the page is moved far to one direction and then is flung
- // in the opposite direction, we use a threshold to determine whether we should
- // just return to the starting page, or if we should skip one further.
- boolean returnToOriginalPage = false;
- if (Math.abs(deltaX) > pageWidth * RETURN_TO_ORIGINAL_PAGE_THRESHOLD &&
- Math.signum(velocityX) != Math.signum(deltaX) && isFling) {
- returnToOriginalPage = true;
- }
-
- int finalPage;
- // We give flings precedence over large moves, which is why we short-circuit our
- // test for a large move if a fling has been registered. That is, a large
- // move to the left and fling to the right will register as a fling to the right.
- if (((isSignificantMove && deltaX > 0 && !isFling) ||
- (isFling && velocityX > 0)) && mCurrentPage > 0) {
- finalPage = returnToOriginalPage || isWarping()
- ? mCurrentPage : mCurrentPage - 1;
- snapToPageWithVelocity(finalPage, velocityX);
- } else if (((isSignificantMove && deltaX < 0 && !isFling) ||
- (isFling && velocityX < 0)) &&
- mCurrentPage < getChildCount() - 1) {
- finalPage = returnToOriginalPage ? mCurrentPage :
- isWarping() ? getPageWarpIndex() : mCurrentPage + 1;
- snapToPageWithVelocity(finalPage, velocityX);
- } else {
- snapToDestination();
- }
- } else if (mTouchState == TOUCH_STATE_PREV_PAGE) {
- // at this point we have not moved beyond the touch slop
- // (otherwise mTouchState would be TOUCH_STATE_SCROLLING), so
- // we can just page
- int nextPage = Math.max(0, mCurrentPage - 1);
- if (nextPage != mCurrentPage) {
- snapToPage(nextPage);
- } else {
- snapToDestination();
- }
- } else if (mTouchState == TOUCH_STATE_NEXT_PAGE) {
- // at this point we have not moved beyond the touch slop
- // (otherwise mTouchState would be TOUCH_STATE_SCROLLING), so
- // we can just page
- int nextPage = Math.min(getChildCount() - 1, mCurrentPage + 1);
- if (nextPage != mCurrentPage) {
- snapToPage(nextPage);
- } else {
- snapToDestination();
- }
- } else if (mTouchState == TOUCH_STATE_REORDERING) {
- // Update the last motion position
- mLastMotionX = ev.getX();
- mLastMotionY = ev.getY();
-
- // Update the parent down so that our zoom animations take this new movement into
- // account
- float[] pt = mapPointFromViewToParent(this, mLastMotionX, mLastMotionY);
- mParentDownMotionX = pt[0];
- mParentDownMotionY = pt[1];
- updateDragViewTranslationDuringDrag();
- boolean handledFling = false;
- if (!DISABLE_FLING_TO_DELETE) {
- // Check the velocity and see if we are flinging-to-delete
- PointF flingToDeleteVector = isFlingingToDelete();
- if (flingToDeleteVector != null) {
- onFlingToDelete(flingToDeleteVector);
- handledFling = true;
- }
- }
- if (!handledFling && isHoveringOverDeleteDropTarget((int) mParentDownMotionX,
- (int) mParentDownMotionY)) {
- onDropToDelete();
- }
- } else {
- if (DEBUG_WARP) Log.v(TAG, "calling onUnhandledTap()");
- if (mWarpPageExposed && !isAnimatingWarpPage()) {
- animateWarpPageOffScreen("unhandled tap", true);
- }
- onUnhandledTap(ev);
- }
-
- // Remove the callback to wait for the side page hover timeout
- removeCallbacks(mSidePageHoverRunnable);
- // End any intermediate reordering states
- resetTouchState();
- break;
-
- case MotionEvent.ACTION_CANCEL:
- if (mTouchState == TOUCH_STATE_SCROLLING) {
- snapToDestination();
- }
- resetTouchState();
- break;
-
- case MotionEvent.ACTION_POINTER_UP:
- onSecondaryPointerUp(ev);
- break;
- }
-
- return true;
- }
-
- //public abstract void onFlingToDelete(View v);
- public abstract void onRemoveView(View v, boolean deletePermanently);
- public abstract void onRemoveViewAnimationCompleted();
- public abstract void onAddView(View v, int index);
-
- private void resetTouchState() {
- releaseVelocityTracker();
- endReordering();
- setTouchState(TOUCH_STATE_REST);
- mActivePointerId = INVALID_POINTER;
- mDownEventOnEdge = false;
- }
-
- protected void onUnhandledTap(MotionEvent ev) {}
-
- @Override
- public boolean onGenericMotionEvent(MotionEvent event) {
- if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
- switch (event.getAction()) {
- case MotionEvent.ACTION_SCROLL: {
- // Handle mouse (or ext. device) by shifting the page depending on the scroll
- final float vscroll;
- final float hscroll;
- if ((event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0) {
- vscroll = 0;
- hscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
- } else {
- vscroll = -event.getAxisValue(MotionEvent.AXIS_VSCROLL);
- hscroll = event.getAxisValue(MotionEvent.AXIS_HSCROLL);
- }
- if (hscroll != 0 || vscroll != 0) {
- if (hscroll > 0 || vscroll > 0) {
- scrollRight();
- } else {
- scrollLeft();
- }
- return true;
- }
- }
- }
- }
- return super.onGenericMotionEvent(event);
- }
-
- private void acquireVelocityTrackerAndAddMovement(MotionEvent ev) {
- if (mVelocityTracker == null) {
- mVelocityTracker = VelocityTracker.obtain();
- }
- mVelocityTracker.addMovement(ev);
- }
-
- private void releaseVelocityTracker() {
- if (mVelocityTracker != null) {
- mVelocityTracker.recycle();
- mVelocityTracker = null;
- }
- }
-
- private void onSecondaryPointerUp(MotionEvent ev) {
- final int pointerIndex = (ev.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >>
- MotionEvent.ACTION_POINTER_INDEX_SHIFT;
- final int pointerId = ev.getPointerId(pointerIndex);
- if (pointerId == mActivePointerId) {
- // This was our active pointer going up. Choose a new
- // active pointer and adjust accordingly.
- // TODO: Make this decision more intelligent.
- final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
- mLastMotionX = mDownMotionX = ev.getX(newPointerIndex);
- mLastMotionY = ev.getY(newPointerIndex);
- mLastMotionXRemainder = 0;
- mActivePointerId = ev.getPointerId(newPointerIndex);
- if (mVelocityTracker != null) {
- mVelocityTracker.clear();
- }
- }
- }
-
- @Override
- public void requestChildFocus(View child, View focused) {
- super.requestChildFocus(child, focused);
- int page = indexToPage(indexOfChild(child));
- if (page >= 0 && page != getCurrentPage() && !isInTouchMode()) {
- snapToPage(page);
- }
- }
-
- protected int getChildIndexForRelativeOffset(int relativeOffset) {
- final int childCount = getChildCount();
- int left;
- int right;
- for (int i = 0; i < childCount; ++i) {
- left = getRelativeChildOffset(i);
- right = (left + getScaledMeasuredWidth(getPageAt(i)));
- if (left <= relativeOffset && relativeOffset <= right) {
- return i;
- }
- }
- return -1;
- }
-
- protected int getChildWidth(int index) {
- // This functions are called enough times that it actually makes a difference in the
- // profiler -- so just inline the max() here
- final int measuredWidth = getPageAt(index).getMeasuredWidth();
- final int minWidth = mMinimumWidth;
- return (minWidth > measuredWidth) ? minWidth : measuredWidth;
- }
-
- int getPageNearestToPoint(float x) {
- int index = 0;
- for (int i = 0; i < getChildCount(); ++i) {
- if (x < getChildAt(i).getRight() - getScrollX()) {
- return index;
- } else {
- index++;
- }
- }
- return Math.min(index, getChildCount() - 1);
- }
-
- int getPageNearestToCenterOfScreen() {
- int minDistanceFromScreenCenter = Integer.MAX_VALUE;
- int minDistanceFromScreenCenterIndex = -1;
- int screenCenter = getViewportOffsetX() + getScrollX() + (getViewportWidth() / 2);
- final int childCount = getChildCount();
- for (int i = 0; i < childCount; ++i) {
- View layout = (View) getPageAt(i);
- int childWidth = getScaledMeasuredWidth(layout);
- int halfChildWidth = (childWidth / 2);
- int childCenter = getViewportOffsetX() + getChildOffset(i) + halfChildWidth;
- int distanceFromScreenCenter = Math.abs(childCenter - screenCenter);
- if (distanceFromScreenCenter < minDistanceFromScreenCenter) {
- minDistanceFromScreenCenter = distanceFromScreenCenter;
- minDistanceFromScreenCenterIndex = i;
- }
- }
- return minDistanceFromScreenCenterIndex;
- }
-
- protected void snapToDestination() {
- final int newPage = getPageNearestToCenterOfScreen();
- if (isWarping()) {
- cancelWarpAnimation("snapToDestination", mCurrentPage != newPage);
- }
- snapToPage(newPage, getPageSnapDuration());
- }
-
- private int getPageSnapDuration() {
- return isWarping() ? WARP_SNAP_DURATION : PAGE_SNAP_ANIMATION_DURATION;
- }
-
- private static class ScrollInterpolator implements Interpolator {
- public ScrollInterpolator() {
- }
-
- public float getInterpolation(float t) {
- t -= 1.0f;
- return t*t*t*t*t + 1;
- }
- }
-
- // We want the duration of the page snap animation to be influenced by the distance that
- // the screen has to travel, however, we don't want this duration to be effected in a
- // purely linear fashion. Instead, we use this method to moderate the effect that the distance
- // of travel has on the overall snap duration.
- float distanceInfluenceForSnapDuration(float f) {
- f -= 0.5f; // center the values about 0.
- f *= 0.3f * Math.PI / 2.0f;
- return (float) Math.sin(f);
- }
-
- protected void snapToPageWithVelocity(int whichPage, int velocity) {
- whichPage = Math.max(0, Math.min(whichPage, getChildCount() - 1));
- int halfScreenSize = getViewportWidth() / 2;
-
- if (isWarping()) {
- cancelWarpAnimation("snapToPageWithVelocity", mCurrentPage != whichPage);
- }
-
- if (DEBUG) Log.d(TAG, "snapToPage.getChildOffset(): " + getChildOffset(whichPage));
- if (DEBUG) Log.d(TAG, "snapToPageWithVelocity.getRelativeChildOffset(): "
- + getViewportWidth() + ", " + getChildWidth(whichPage));
- final int newX = getChildOffset(whichPage) - getRelativeChildOffset(whichPage);
- int delta = newX - mUnboundedScrollX;
- int duration = 0;
-
- if (Math.abs(velocity) < mMinFlingVelocity) {
- // If the velocity is low enough, then treat this more as an automatic page advance
- // as opposed to an apparent physical response to flinging
- snapToPage(whichPage, getPageSnapDuration());
- return;
- }
-
- // Here we compute a "distance" that will be used in the computation of the overall
- // snap duration. This is a function of the actual distance that needs to be traveled;
- // we keep this value close to half screen size in order to reduce the variance in snap
- // duration as a function of the distance the page needs to travel.
- float distanceRatio = Math.min(1f, 1.0f * Math.abs(delta) / (2 * halfScreenSize));
- float distance = halfScreenSize + halfScreenSize *
- distanceInfluenceForSnapDuration(distanceRatio);
-
- velocity = Math.abs(velocity);
- velocity = Math.max(mMinSnapVelocity, velocity);
-
- // we want the page's snap velocity to approximately match the velocity at which the
- // user flings, so we scale the duration by a value near to the derivative of the scroll
- // interpolator at zero, ie. 5. We use 4 to make it a little slower.
- duration = 4 * Math.round(1000 * Math.abs(distance / velocity));
-
- snapToPage(whichPage, delta, duration);
- }
-
- protected void snapToPage(int whichPage) {
- snapToPage(whichPage, getPageSnapDuration());
- }
- protected void snapToPageImmediately(int whichPage) {
- snapToPage(whichPage, getPageSnapDuration(), true);
- }
-
- protected void snapToPage(int whichPage, int duration) {
- snapToPage(whichPage, duration, false);
- }
- protected void snapToPage(int whichPage, int duration, boolean immediate) {
- whichPage = Math.max(0, Math.min(whichPage, getPageCount() - 1));
-
- if (DEBUG) Log.d(TAG, "snapToPage.getChildOffset(): " + getChildOffset(whichPage));
- if (DEBUG) Log.d(TAG, "snapToPage.getRelativeChildOffset(): " + getViewportWidth() + ", "
- + getChildWidth(whichPage));
- int newX = getChildOffset(whichPage) - getRelativeChildOffset(whichPage);
- final int sX = mUnboundedScrollX;
- final int delta = newX - sX;
- snapToPage(whichPage, delta, duration, immediate);
- }
-
- protected void snapToPage(int whichPage, int delta, int duration) {
- snapToPage(whichPage, delta, duration, false);
- }
-
- protected void snapToPage(int whichPage, int delta, int duration, boolean immediate) {
- if (isWarping() && whichPage == mCurrentPage+1) {
- mNextPage = getPageWarpIndex(); // jump to the warp page
- if (DEBUG_WARP) Log.v(TAG, "snapToPage(" + whichPage + ") : reset mPageSwapIndex");
- } else {
- mNextPage = whichPage;
- }
-
- if(mWarpPageExposed) {
- dispatchOnPageEndWarp();
- mWarpPageExposed = false;
- }
- notifyPageSwitching(whichPage);
-
-
- View focusedChild = getFocusedChild();
- if (focusedChild != null && whichPage != mCurrentPage &&
- focusedChild == getPageAt(mCurrentPage)) {
- focusedChild.clearFocus();
- }
-
- pageBeginMoving();
- awakenScrollBars(duration);
- if (immediate) {
- duration = 0;
- } else if (duration == 0) {
- duration = Math.abs(delta);
- }
-
- if (!mScroller.isFinished()) mScroller.abortAnimation();
- mScroller.startScroll(mUnboundedScrollX, 0, delta, 0, duration);
-
- notifyPageSwitched();
-
- // Trigger a compute() to finish switching pages if necessary
- if (immediate) {
- computeScroll();
- }
-
- mForceScreenScrolled = true;
- invalidate();
- }
-
- protected boolean isWarping() {
- return mWarpPageExposed;
- }
-
- public void scrollLeft() {
- if (mScroller.isFinished()) {
- if (mCurrentPage > 0) snapToPage(mCurrentPage - 1);
- } else {
- if (mNextPage > 0) snapToPage(mNextPage - 1);
- }
- }
-
- public void scrollRight() {
- if (mScroller.isFinished()) {
- if (mCurrentPage < getChildCount() -1) snapToPage(mCurrentPage + 1);
- } else {
- if (mNextPage < getChildCount() -1) snapToPage(mNextPage + 1);
- }
- }
-
- public int getPageForView(View v) {
- int result = -1;
- if (v != null) {
- ViewParent vp = v.getParent();
- int count = getChildCount();
- for (int i = 0; i < count; i++) {
- if (vp == getPageAt(i)) {
- return i;
- }
- }
- }
- return result;
- }
-
- public static class SavedState extends BaseSavedState {
- int currentPage = -1;
-
- SavedState(Parcelable superState) {
- super(superState);
- }
-
- private SavedState(Parcel in) {
- super(in);
- currentPage = in.readInt();
- }
-
- @Override
- public void writeToParcel(Parcel out, int flags) {
- super.writeToParcel(out, flags);
- out.writeInt(currentPage);
- }
-
- public static final Parcelable.Creator<SavedState> CREATOR =
- new Parcelable.Creator<SavedState>() {
- public SavedState createFromParcel(Parcel in) {
- return new SavedState(in);
- }
-
- public SavedState[] newArray(int size) {
- return new SavedState[size];
- }
- };
- }
-
- protected View getScrollingIndicator() {
- return null;
- }
-
- protected boolean isScrollingIndicatorEnabled() {
- return false;
- }
-
- Runnable hideScrollingIndicatorRunnable = new Runnable() {
- @Override
- public void run() {
- hideScrollingIndicator(false);
- }
- };
-
- protected void flashScrollingIndicator(boolean animated) {
- removeCallbacks(hideScrollingIndicatorRunnable);
- showScrollingIndicator(!animated);
- postDelayed(hideScrollingIndicatorRunnable, sScrollIndicatorFlashDuration);
- }
-
- protected void showScrollingIndicator(boolean immediately) {
- mShouldShowScrollIndicator = true;
- mShouldShowScrollIndicatorImmediately = true;
- if (getChildCount() <= 1) return;
- if (!isScrollingIndicatorEnabled()) return;
-
- mShouldShowScrollIndicator = false;
- getScrollingIndicator();
- if (mScrollIndicator != null) {
- // Fade the indicator in
- updateScrollingIndicatorPosition();
- mScrollIndicator.setVisibility(View.VISIBLE);
- cancelScrollingIndicatorAnimations();
- if (immediately) {
- mScrollIndicator.setAlpha(1f);
- } else {
- mScrollIndicatorAnimator = ObjectAnimator.ofFloat(mScrollIndicator, "alpha", 1f);
- mScrollIndicatorAnimator.setDuration(sScrollIndicatorFadeInDuration);
- mScrollIndicatorAnimator.start();
- }
- }
- }
-
- protected void cancelScrollingIndicatorAnimations() {
- if (mScrollIndicatorAnimator != null) {
- mScrollIndicatorAnimator.cancel();
- }
- }
-
- protected void hideScrollingIndicator(boolean immediately) {
- if (getChildCount() <= 1) return;
- if (!isScrollingIndicatorEnabled()) return;
-
- getScrollingIndicator();
- if (mScrollIndicator != null) {
- // Fade the indicator out
- updateScrollingIndicatorPosition();
- cancelScrollingIndicatorAnimations();
- if (immediately) {
- mScrollIndicator.setVisibility(View.INVISIBLE);
- mScrollIndicator.setAlpha(0f);
- } else {
- mScrollIndicatorAnimator = ObjectAnimator.ofFloat(mScrollIndicator, "alpha", 0f);
- mScrollIndicatorAnimator.setDuration(sScrollIndicatorFadeOutDuration);
- mScrollIndicatorAnimator.addListener(new AnimatorListenerAdapter() {
- private boolean cancelled = false;
- @Override
- public void onAnimationCancel(android.animation.Animator animation) {
- cancelled = true;
- }
- @Override
- public void onAnimationEnd(Animator animation) {
- if (!cancelled) {
- mScrollIndicator.setVisibility(View.INVISIBLE);
- }
- }
- });
- mScrollIndicatorAnimator.start();
- }
- }
- }
-
- /**
- * To be overridden by subclasses to determine whether the scroll indicator should stretch to
- * fill its space on the track or not.
- */
- protected boolean hasElasticScrollIndicator() {
- return true;
- }
-
- private void updateScrollingIndicator() {
- if (getChildCount() <= 1) return;
- if (!isScrollingIndicatorEnabled()) return;
-
- getScrollingIndicator();
- if (mScrollIndicator != null) {
- updateScrollingIndicatorPosition();
- }
- if (mShouldShowScrollIndicator) {
- showScrollingIndicator(mShouldShowScrollIndicatorImmediately);
- }
- }
-
- private void updateScrollingIndicatorPosition() {
- if (!isScrollingIndicatorEnabled()) return;
- if (mScrollIndicator == null) return;
- int numPages = getChildCount();
- int pageWidth = getViewportWidth();
- int lastChildIndex = Math.max(0, getChildCount() - 1);
- int maxScrollX = getChildOffset(lastChildIndex) - getRelativeChildOffset(lastChildIndex);
- int trackWidth = pageWidth - mScrollIndicatorPaddingLeft - mScrollIndicatorPaddingRight;
- int indicatorWidth = mScrollIndicator.getMeasuredWidth() -
- mScrollIndicator.getPaddingLeft() - mScrollIndicator.getPaddingRight();
-
- float offset = Math.max(0f, Math.min(1f, (float) getScrollX() / maxScrollX));
- int indicatorSpace = trackWidth / numPages;
- int indicatorPos = (int) (offset * (trackWidth - indicatorSpace)) + mScrollIndicatorPaddingLeft;
- if (hasElasticScrollIndicator()) {
- if (mScrollIndicator.getMeasuredWidth() != indicatorSpace) {
- mScrollIndicator.getLayoutParams().width = indicatorSpace;
- mScrollIndicator.requestLayout();
- }
- } else {
- int indicatorCenterOffset = indicatorSpace / 2 - indicatorWidth / 2;
- indicatorPos += indicatorCenterOffset;
- }
- mScrollIndicator.setTranslationX(indicatorPos);
- }
-
- // Animate the drag view back to the original position
- void animateDragViewToOriginalPosition() {
- if (mDragView != null) {
- AnimatorSet anim = new AnimatorSet();
- anim.setDuration(REORDERING_DROP_REPOSITION_DURATION);
- anim.playTogether(
- ObjectAnimator.ofFloat(mDragView, "translationX", 0f),
- ObjectAnimator.ofFloat(mDragView, "translationY", 0f));
- anim.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- onPostReorderingAnimationCompleted();
- }
- });
- anim.start();
- }
- }
-
- // "Zooms out" the PagedView to reveal more side pages
- protected boolean zoomOut() {
- if (mZoomInOutAnim != null && mZoomInOutAnim.isRunning()) {
- mZoomInOutAnim.cancel();
- }
-
- if (!(getScaleX() < 1f || getScaleY() < 1f)) {
- mZoomInOutAnim = new AnimatorSet();
- mZoomInOutAnim.setDuration(REORDERING_ZOOM_IN_OUT_DURATION);
- mZoomInOutAnim.playTogether(
- ObjectAnimator.ofFloat(this, "scaleX", mMinScale),
- ObjectAnimator.ofFloat(this, "scaleY", mMinScale));
- mZoomInOutAnim.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- // Show the delete drop target
- if (mDeleteDropTarget != null) {
- mDeleteDropTarget.setVisibility(View.VISIBLE);
- mDeleteDropTarget.animate().alpha(1f)
- .setDuration(REORDERING_DELETE_DROP_TARGET_FADE_DURATION)
- .setListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- mDeleteDropTarget.setAlpha(0f);
- }
- });
- }
- }
- });
- mZoomInOutAnim.start();
- return true;
- }
- return false;
- }
-
- protected void onStartReordering() {
- if (AccessibilityManager.getInstance(mContext).isEnabled()) {
- announceForAccessibility(mContext.getString(
- R.string.keyguard_accessibility_widget_reorder_start));
- }
-
- // Set the touch state to reordering (allows snapping to pages, dragging a child, etc.)
- setTouchState(TOUCH_STATE_REORDERING);
- mIsReordering = true;
-
- // Mark all the non-widget pages as invisible
- getVisiblePages(mTempVisiblePagesRange);
- boundByReorderablePages(true, mTempVisiblePagesRange);
- for (int i = 0; i < getPageCount(); ++i) {
- if (i < mTempVisiblePagesRange[0] || i > mTempVisiblePagesRange[1]) {
- getPageAt(i).setAlpha(0f);
- }
- }
-
- // We must invalidate to trigger a redraw to update the layers such that the drag view
- // is always drawn on top
- invalidate();
- }
-
- private void onPostReorderingAnimationCompleted() {
- // Trigger the callback when reordering has settled
- --mPostReorderingPreZoomInRemainingAnimationCount;
- if (mPostReorderingPreZoomInRunnable != null &&
- mPostReorderingPreZoomInRemainingAnimationCount == 0) {
- mPostReorderingPreZoomInRunnable.run();
- mPostReorderingPreZoomInRunnable = null;
- }
- }
-
- protected void onEndReordering() {
- if (AccessibilityManager.getInstance(mContext).isEnabled()) {
- if (mDeleteString != null) {
- announceForAccessibility(mDeleteString);
- mDeleteString = null;
- } else {
- announceForAccessibility(mContext.getString(
- R.string.keyguard_accessibility_widget_reorder_end));
- }
- }
- mIsReordering = false;
-
- // Mark all the non-widget pages as visible again
- getVisiblePages(mTempVisiblePagesRange);
- boundByReorderablePages(true, mTempVisiblePagesRange);
- for (int i = 0; i < getPageCount(); ++i) {
- if (i < mTempVisiblePagesRange[0] || i > mTempVisiblePagesRange[1]) {
- getPageAt(i).setAlpha(1f);
- }
- }
- }
-
- public boolean startReordering() {
- int dragViewIndex = getPageNearestToCenterOfScreen();
- mTempVisiblePagesRange[0] = 0;
- mTempVisiblePagesRange[1] = getPageCount() - 1;
- boundByReorderablePages(true, mTempVisiblePagesRange);
-
- // Check if we are within the reordering range
- if (mTempVisiblePagesRange[0] <= dragViewIndex &&
- dragViewIndex <= mTempVisiblePagesRange[1]) {
- mReorderingStarted = true;
- if (zoomOut()) {
- // Find the drag view under the pointer
- mDragView = getChildAt(dragViewIndex);
-
- onStartReordering();
- }
- return true;
- }
- return false;
- }
-
- boolean isReordering(boolean testTouchState) {
- boolean state = mIsReordering;
- if (testTouchState) {
- state &= (mTouchState == TOUCH_STATE_REORDERING);
- }
- return state;
- }
- void endReordering() {
- // For simplicity, we call endReordering sometimes even if reordering was never started.
- // In that case, we don't want to do anything.
- if (!mReorderingStarted) return;
- mReorderingStarted = false;
-
- // If we haven't flung-to-delete the current child, then we just animate the drag view
- // back into position
- final Runnable onCompleteRunnable = new Runnable() {
- @Override
- public void run() {
- onEndReordering();
- }
- };
- if (!mDeferringForDelete) {
- mPostReorderingPreZoomInRunnable = new Runnable() {
- public void run() {
- zoomIn(onCompleteRunnable);
- };
- };
-
- mPostReorderingPreZoomInRemainingAnimationCount =
- NUM_ANIMATIONS_RUNNING_BEFORE_ZOOM_OUT;
- // Snap to the current page
- snapToPage(indexOfChild(mDragView), 0);
- // Animate the drag view back to the front position
- animateDragViewToOriginalPosition();
- } else {
- // Handled in post-delete-animation-callbacks
- }
- }
-
- // "Zooms in" the PagedView to highlight the current page
- protected boolean zoomIn(final Runnable onCompleteRunnable) {
- if (mZoomInOutAnim != null && mZoomInOutAnim.isRunning()) {
- mZoomInOutAnim.cancel();
- }
- if (getScaleX() < 1f || getScaleY() < 1f) {
- mZoomInOutAnim = new AnimatorSet();
- mZoomInOutAnim.setDuration(REORDERING_ZOOM_IN_OUT_DURATION);
- mZoomInOutAnim.playTogether(
- ObjectAnimator.ofFloat(this, "scaleX", 1f),
- ObjectAnimator.ofFloat(this, "scaleY", 1f));
- mZoomInOutAnim.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- // Hide the delete drop target
- if (mDeleteDropTarget != null) {
- mDeleteDropTarget.animate().alpha(0f)
- .setDuration(REORDERING_DELETE_DROP_TARGET_FADE_DURATION)
- .setListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mDeleteDropTarget.setVisibility(View.GONE);
- }
- });
- }
- }
- @Override
- public void onAnimationCancel(Animator animation) {
- mDragView = null;
- }
- @Override
- public void onAnimationEnd(Animator animation) {
- mDragView = null;
- if (onCompleteRunnable != null) {
- onCompleteRunnable.run();
- }
- }
- });
- mZoomInOutAnim.start();
- return true;
- } else {
- if (onCompleteRunnable != null) {
- onCompleteRunnable.run();
- }
- }
- return false;
- }
-
- /*
- * Flinging to delete - IN PROGRESS
- */
- private PointF isFlingingToDelete() {
- ViewConfiguration config = ViewConfiguration.get(getContext());
- mVelocityTracker.computeCurrentVelocity(1000, config.getScaledMaximumFlingVelocity());
-
- if (mVelocityTracker.getYVelocity() < mFlingToDeleteThresholdVelocity) {
- // Do a quick dot product test to ensure that we are flinging upwards
- PointF vel = new PointF(mVelocityTracker.getXVelocity(),
- mVelocityTracker.getYVelocity());
- PointF upVec = new PointF(0f, -1f);
- float theta = (float) Math.acos(((vel.x * upVec.x) + (vel.y * upVec.y)) /
- (vel.length() * upVec.length()));
- if (theta <= Math.toRadians(FLING_TO_DELETE_MAX_FLING_DEGREES)) {
- return vel;
- }
- }
- return null;
- }
-
- /**
- * Creates an animation from the current drag view along its current velocity vector.
- * For this animation, the alpha runs for a fixed duration and we update the position
- * progressively.
- */
- private static class FlingAlongVectorAnimatorUpdateListener implements AnimatorUpdateListener {
- private View mDragView;
- private PointF mVelocity;
- private Rect mFrom;
- private long mPrevTime;
- private float mFriction;
-
- private final TimeInterpolator mAlphaInterpolator = new DecelerateInterpolator(0.75f);
-
- public FlingAlongVectorAnimatorUpdateListener(View dragView, PointF vel, Rect from,
- long startTime, float friction) {
- mDragView = dragView;
- mVelocity = vel;
- mFrom = from;
- mPrevTime = startTime;
- mFriction = 1f - (mDragView.getResources().getDisplayMetrics().density * friction);
- }
-
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
- float t = ((Float) animation.getAnimatedValue()).floatValue();
- long curTime = AnimationUtils.currentAnimationTimeMillis();
-
- mFrom.left += (mVelocity.x * (curTime - mPrevTime) / 1000f);
- mFrom.top += (mVelocity.y * (curTime - mPrevTime) / 1000f);
-
- mDragView.setTranslationX(mFrom.left);
- mDragView.setTranslationY(mFrom.top);
- mDragView.setAlpha(1f - mAlphaInterpolator.getInterpolation(t));
-
- mVelocity.x *= mFriction;
- mVelocity.y *= mFriction;
- mPrevTime = curTime;
- }
- };
-
- private Runnable createPostDeleteAnimationRunnable(final View dragView) {
- return new Runnable() {
- @Override
- public void run() {
- int dragViewIndex = indexOfChild(dragView);
-
- // For each of the pages around the drag view, animate them from the previous
- // position to the new position in the layout (as a result of the drag view moving
- // in the layout)
- // NOTE: We can make an assumption here because we have side-bound pages that we
- // will always have pages to animate in from the left
- getVisiblePages(mTempVisiblePagesRange);
- boundByReorderablePages(true, mTempVisiblePagesRange);
- boolean isLastWidgetPage = (mTempVisiblePagesRange[0] == mTempVisiblePagesRange[1]);
- boolean slideFromLeft = (isLastWidgetPage ||
- dragViewIndex > mTempVisiblePagesRange[0]);
-
- // Setup the scroll to the correct page before we swap the views
- if (slideFromLeft) {
- snapToPageImmediately(dragViewIndex - 1);
- }
-
- int firstIndex = (isLastWidgetPage ? 0 : mTempVisiblePagesRange[0]);
- int lastIndex = Math.min(mTempVisiblePagesRange[1], getPageCount() - 1);
- int lowerIndex = (slideFromLeft ? firstIndex : dragViewIndex + 1 );
- int upperIndex = (slideFromLeft ? dragViewIndex - 1 : lastIndex);
- ArrayList<Animator> animations = new ArrayList<Animator>();
- for (int i = lowerIndex; i <= upperIndex; ++i) {
- View v = getChildAt(i);
- // dragViewIndex < pageUnderPointIndex, so after we remove the
- // drag view all subsequent views to pageUnderPointIndex will
- // shift down.
- int oldX = 0;
- int newX = 0;
- if (slideFromLeft) {
- if (i == 0) {
- // Simulate the page being offscreen with the page spacing
- oldX = getViewportOffsetX() + getChildOffset(i) - getChildWidth(i)
- - mPageSpacing;
- } else {
- oldX = getViewportOffsetX() + getChildOffset(i - 1);
- }
- newX = getViewportOffsetX() + getChildOffset(i);
- } else {
- oldX = getChildOffset(i) - getChildOffset(i - 1);
- newX = 0;
- }
-
- // Animate the view translation from its old position to its new
- // position
- AnimatorSet anim = (AnimatorSet) v.getTag();
- if (anim != null) {
- anim.cancel();
- }
-
- // Note: Hacky, but we want to skip any optimizations to not draw completely
- // hidden views
- v.setAlpha(Math.max(v.getAlpha(), 0.01f));
- v.setTranslationX(oldX - newX);
- anim = new AnimatorSet();
- anim.playTogether(
- ObjectAnimator.ofFloat(v, "translationX", 0f),
- ObjectAnimator.ofFloat(v, "alpha", 1f));
- animations.add(anim);
- v.setTag(anim);
- }
-
- AnimatorSet slideAnimations = new AnimatorSet();
- slideAnimations.playTogether(animations);
- slideAnimations.setDuration(DELETE_SLIDE_IN_SIDE_PAGE_DURATION);
- slideAnimations.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- final Runnable onCompleteRunnable = new Runnable() {
- @Override
- public void run() {
- mDeferringForDelete = false;
- onEndReordering();
- onRemoveViewAnimationCompleted();
- }
- };
- zoomIn(onCompleteRunnable);
- }
- });
- slideAnimations.start();
-
- removeView(dragView);
- onRemoveView(dragView, true);
- }
- };
- }
-
- public void onFlingToDelete(PointF vel) {
- final long startTime = AnimationUtils.currentAnimationTimeMillis();
-
- // NOTE: Because it takes time for the first frame of animation to actually be
- // called and we expect the animation to be a continuation of the fling, we have
- // to account for the time that has elapsed since the fling finished. And since
- // we don't have a startDelay, we will always get call to update when we call
- // start() (which we want to ignore).
- final TimeInterpolator tInterpolator = new TimeInterpolator() {
- private int mCount = -1;
- private long mStartTime;
- private float mOffset;
- /* Anonymous inner class ctor */ {
- mStartTime = startTime;
- }
-
- @Override
- public float getInterpolation(float t) {
- if (mCount < 0) {
- mCount++;
- } else if (mCount == 0) {
- mOffset = Math.min(0.5f, (float) (AnimationUtils.currentAnimationTimeMillis() -
- mStartTime) / FLING_TO_DELETE_FADE_OUT_DURATION);
- mCount++;
- }
- return Math.min(1f, mOffset + t);
- }
- };
-
- final Rect from = new Rect();
- final View dragView = mDragView;
- from.left = (int) dragView.getTranslationX();
- from.top = (int) dragView.getTranslationY();
- AnimatorUpdateListener updateCb = new FlingAlongVectorAnimatorUpdateListener(dragView, vel,
- from, startTime, FLING_TO_DELETE_FRICTION);
-
- mDeleteString = getContext().getResources()
- .getString(R.string.keyguard_accessibility_widget_deleted,
- mDragView.getContentDescription());
- final Runnable onAnimationEndRunnable = createPostDeleteAnimationRunnable(dragView);
-
- // Create and start the animation
- ValueAnimator mDropAnim = new ValueAnimator();
- mDropAnim.setInterpolator(tInterpolator);
- mDropAnim.setDuration(FLING_TO_DELETE_FADE_OUT_DURATION);
- mDropAnim.setFloatValues(0f, 1f);
- mDropAnim.addUpdateListener(updateCb);
- mDropAnim.addListener(new AnimatorListenerAdapter() {
- public void onAnimationEnd(Animator animation) {
- onAnimationEndRunnable.run();
- }
- });
- mDropAnim.start();
- mDeferringForDelete = true;
- }
-
- /* Drag to delete */
- private boolean isHoveringOverDeleteDropTarget(int x, int y) {
- if (mDeleteDropTarget != null) {
- mAltTmpRect.set(0, 0, 0, 0);
- View parent = (View) mDeleteDropTarget.getParent();
- if (parent != null) {
- parent.getGlobalVisibleRect(mAltTmpRect);
- }
- mDeleteDropTarget.getGlobalVisibleRect(mTmpRect);
- mTmpRect.offset(-mAltTmpRect.left, -mAltTmpRect.top);
- return mTmpRect.contains(x, y);
- }
- return false;
- }
-
- protected void setPageHoveringOverDeleteDropTarget(int viewIndex, boolean isHovering) {}
-
- private void onDropToDelete() {
- final View dragView = mDragView;
-
- final float toScale = 0f;
- final float toAlpha = 0f;
-
- // Create and start the complex animation
- ArrayList<Animator> animations = new ArrayList<Animator>();
- AnimatorSet motionAnim = new AnimatorSet();
- motionAnim.setInterpolator(new DecelerateInterpolator(2));
- motionAnim.playTogether(
- ObjectAnimator.ofFloat(dragView, "scaleX", toScale),
- ObjectAnimator.ofFloat(dragView, "scaleY", toScale));
- animations.add(motionAnim);
-
- AnimatorSet alphaAnim = new AnimatorSet();
- alphaAnim.setInterpolator(new LinearInterpolator());
- alphaAnim.playTogether(
- ObjectAnimator.ofFloat(dragView, "alpha", toAlpha));
- animations.add(alphaAnim);
-
- mDeleteString = getContext().getResources()
- .getString(R.string.keyguard_accessibility_widget_deleted,
- mDragView.getContentDescription());
- final Runnable onAnimationEndRunnable = createPostDeleteAnimationRunnable(dragView);
-
- AnimatorSet anim = new AnimatorSet();
- anim.playTogether(animations);
- anim.setDuration(DRAG_TO_DELETE_FADE_OUT_DURATION);
- anim.addListener(new AnimatorListenerAdapter() {
- public void onAnimationEnd(Animator animation) {
- onAnimationEndRunnable.run();
- }
- });
- anim.start();
-
- mDeferringForDelete = true;
- }
-
- /* Accessibility */
- @Override
- public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
- super.onInitializeAccessibilityNodeInfo(info);
- info.setScrollable(getPageCount() > 1);
- if (getCurrentPage() < getPageCount() - 1) {
- info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
- }
- if (getCurrentPage() > 0) {
- info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
- }
- }
-
- @Override
- public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
- super.onInitializeAccessibilityEvent(event);
- event.setScrollable(true);
- if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED) {
- event.setFromIndex(mCurrentPage);
- event.setToIndex(mCurrentPage);
- event.setItemCount(getChildCount());
- }
- }
-
- @Override
- public boolean performAccessibilityAction(int action, Bundle arguments) {
- if (super.performAccessibilityAction(action, arguments)) {
- return true;
- }
- switch (action) {
- case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
- if (getCurrentPage() < getPageCount() - 1) {
- scrollRight();
- return true;
- }
- } break;
- case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: {
- if (getCurrentPage() > 0) {
- scrollLeft();
- return true;
- }
- } break;
- }
- return false;
- }
-
- @Override
- public boolean onHoverEvent(android.view.MotionEvent event) {
- return true;
- }
-
- void beginCameraEvent() {
- mIsCameraEvent = true;
- }
-
- void endCameraEvent() {
- mIsCameraEvent = false;
- }
-
- AnimatorListenerAdapter mOnScreenAnimationListener = new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mWarpAnimation = null;
- if (mTouchState != TOUCH_STATE_SCROLLING && mTouchState != TOUCH_STATE_READY) {
- animateWarpPageOffScreen("onScreen end", true);
- }
- }
-
- @Override
- public void onAnimationCancel(Animator animation) {
- super.onAnimationCancel(animation);
- mWarpAnimation = null;
- }
- };
-
- AnimatorListenerAdapter mOffScreenAnimationListener = new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mWarpAnimation = null;
- mWarpPageExposed = false;
- KeyguardWidgetFrame v = (KeyguardWidgetFrame) getPageAt(getPageWarpIndex());
- v.setTranslationX(0.0f);
- }
-
- @Override
- public void onAnimationCancel(Animator animation) {
- super.onAnimationCancel(animation);
- mWarpAnimation = null;
- }
- };
-
- private void cancelWarpAnimation(String msg, boolean abortAnimation) {
- if (DEBUG_WARP) Log.v(TAG, "cancelWarpAnimation(" + msg + ",abort=" + abortAnimation + ")");
- if (abortAnimation) {
- // We're done with the animation and moving to a new page. Let the scroller
- // take over the animation.
- KeyguardWidgetFrame v = (KeyguardWidgetFrame) getPageAt(getPageWarpIndex());
- v.animate().cancel();
- // Make the scroll amount match the current warp position.
- scrollBy(Math.round(-v.getTranslationX()), 0);
- v.setTranslationX(0);
- } else {
- animateWarpPageOffScreen("canceled", true);
- }
- }
-
- private boolean isAnimatingWarpPage() {
- return mWarpAnimation != null;
- }
-
- private void animateWarpPageOnScreen(String reason) {
- if (DEBUG_WARP) Log.v(TAG, "animateWarpPageOnScreen(" + reason + ")");
- if (!mWarpPageExposed) {
- mWarpPageExposed = true;
- dispatchOnPageBeginWarp();
- KeyguardWidgetFrame v = (KeyguardWidgetFrame) getPageAt(getPageWarpIndex());
- if (DEBUG_WARP) Log.v(TAG, "moving page on screen: Tx=" + v.getTranslationX());
- DecelerateInterpolator interp = new DecelerateInterpolator(1.5f);
- int totalOffset = getCurrentWarpOffset();
- v.setTranslationX(totalOffset);
- mWarpAnimation = v.animate();
- mWarpAnimation.translationX(mWarpPeekAmount+totalOffset)
- .setInterpolator(interp)
- .setDuration(WARP_PEEK_ANIMATION_DURATION)
- .setListener(mOnScreenAnimationListener);
- }
- }
-
- private int getCurrentWarpOffset() {
- if (mCurrentPage == getPageWarpIndex()) {
- return 0;
- }
- View viewRight = getPageAt(mCurrentPage + 1);
- View warpView = getPageAt(getPageWarpIndex());
- if (viewRight != warpView && viewRight != null && warpView != null) {
- return viewRight.getLeft() - warpView.getLeft();
- }
- return 0;
- }
-
- private void animateWarpPageOffScreen(String reason, boolean animate) {
- if (DEBUG_WARP) Log.v(TAG, "animateWarpPageOffScreen(" + reason + " anim:" + animate + ")");
- if (mWarpPageExposed) {
- dispatchOnPageEndWarp();
- KeyguardWidgetFrame v = (KeyguardWidgetFrame) getPageAt(getPageWarpIndex());
- if (DEBUG_WARP) Log.v(TAG, "moving page off screen: Tx=" + v.getTranslationX());
- AccelerateInterpolator interp = new AccelerateInterpolator(1.5f);
- int totalOffset = getCurrentWarpOffset();
- v.animate().translationX(totalOffset)
- .setInterpolator(interp)
- .setDuration(animate ? WARP_PEEK_ANIMATION_DURATION : 0)
- .setListener(mOffScreenAnimationListener);
- } else {
- if (DEBUG_WARP) Log.e(TAG, "animateWarpPageOffScreen(): not warping", new Exception());
- }
- }
-
- /**
- * Swaps the position of the views by setting the left and right edges appropriately.
- */
- void swapPages(int indexA, int indexB) {
- View viewA = getPageAt(indexA);
- View viewB = getPageAt(indexB);
- if (viewA != viewB && viewA != null && viewB != null) {
- int deltaX = viewA.getLeft() - viewB.getLeft();
- viewA.offsetLeftAndRight(-deltaX);
- viewB.offsetLeftAndRight(deltaX);
- }
- }
-
- public void startPageWarp(int pageIndex) {
- if (DEBUG_WARP) Log.v(TAG, "START WARP");
- if (pageIndex != mCurrentPage + 1) {
- mPageSwapIndex = mCurrentPage + 1;
- }
- mPageWarpIndex = pageIndex;
- }
-
- protected int getPageWarpIndex() {
- return getPageCount() - 1;
- }
-
- public void stopPageWarp() {
- if (DEBUG_WARP) Log.v(TAG, "END WARP");
- // mPageSwapIndex is reset in snapToPage() after the scroll animation completes
- }
-
- public void onPageBeginWarp() {
-
- }
-
- public void onPageEndWarp() {
-
- }
-
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/SlidingChallengeLayout.java b/packages/Keyguard/src/com/android/keyguard/SlidingChallengeLayout.java
deleted file mode 100644
index ab9286b..0000000
--- a/packages/Keyguard/src/com/android/keyguard/SlidingChallengeLayout.java
+++ /dev/null
@@ -1,1290 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
-import android.content.Context;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.Rect;
-import android.util.AttributeSet;
-import android.util.DisplayMetrics;
-import android.util.FloatProperty;
-import android.util.Log;
-import android.util.Property;
-import android.view.MotionEvent;
-import android.view.VelocityTracker;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewGroup;
-import android.view.accessibility.AccessibilityManager;
-import android.view.animation.Interpolator;
-import android.widget.Scroller;
-
-/**
- * This layout handles interaction with the sliding security challenge views
- * that overlay/resize other keyguard contents.
- */
-public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout {
- private static final String TAG = "SlidingChallengeLayout";
- private static final boolean DEBUG = KeyguardConstants.DEBUG;
-
- // The drag handle is measured in dp above & below the top edge of the
- // challenge view; these parameters change based on whether the challenge
- // is open or closed.
- private static final int DRAG_HANDLE_CLOSED_ABOVE = 8; // dp
- private static final int DRAG_HANDLE_CLOSED_BELOW = 0; // dp
- private static final int DRAG_HANDLE_OPEN_ABOVE = 8; // dp
- private static final int DRAG_HANDLE_OPEN_BELOW = 0; // dp
-
- private static final int HANDLE_ANIMATE_DURATION = 250; // ms
-
- // Drawn to show the drag handle in closed state; crossfades to the challenge view
- // when challenge is fully visible
- private boolean mEdgeCaptured;
-
- private DisplayMetrics mDisplayMetrics;
-
- // Initialized during measurement from child layoutparams
- private View mExpandChallengeView;
- private KeyguardSecurityContainer mChallengeView;
- private View mScrimView;
- private View mWidgetsView;
-
- // Range: 0 (fully hidden) to 1 (fully visible)
- private float mChallengeOffset = 1.f;
- private boolean mChallengeShowing = true;
- private boolean mChallengeShowingTargetState = true;
- private boolean mWasChallengeShowing = true;
- private boolean mIsBouncing = false;
-
- private final Scroller mScroller;
- private ObjectAnimator mFader;
- private int mScrollState;
- private OnChallengeScrolledListener mScrollListener;
- private OnBouncerStateChangedListener mBouncerListener;
- private boolean mEnableChallengeDragging;
-
- public static final int SCROLL_STATE_IDLE = 0;
- public static final int SCROLL_STATE_DRAGGING = 1;
- public static final int SCROLL_STATE_SETTLING = 2;
- public static final int SCROLL_STATE_FADING = 3;
-
- public static final int CHALLENGE_FADE_OUT_DURATION = 100;
- public static final int CHALLENGE_FADE_IN_DURATION = 160;
-
- private static final int MAX_SETTLE_DURATION = 600; // ms
-
- // ID of the pointer in charge of a current drag
- private int mActivePointerId = INVALID_POINTER;
- private static final int INVALID_POINTER = -1;
-
- // True if the user is currently dragging the slider
- private boolean mDragging;
- // True if the user may not drag until a new gesture begins
- private boolean mBlockDrag;
-
- private VelocityTracker mVelocityTracker;
- private int mMinVelocity;
- private int mMaxVelocity;
- private float mGestureStartX, mGestureStartY; // where did you first touch the screen?
- private int mGestureStartChallengeBottom; // where was the challenge at that time?
-
- private int mDragHandleClosedBelow; // handle hitrect extension into the challenge view
- private int mDragHandleClosedAbove; // extend the handle's hitrect this far above the line
- private int mDragHandleOpenBelow; // handle hitrect extension into the challenge view
- private int mDragHandleOpenAbove; // extend the handle's hitrect this far above the line
-
- private int mDragHandleEdgeSlop;
- private int mChallengeBottomBound; // Number of pixels from the top of the challenge view
- // that should remain on-screen
-
- private int mTouchSlop;
- private int mTouchSlopSquare;
-
- float mHandleAlpha;
- float mFrameAlpha;
- float mFrameAnimationTarget = Float.MIN_VALUE;
- private ObjectAnimator mHandleAnimation;
- private ObjectAnimator mFrameAnimation;
-
- private boolean mHasGlowpad;
- private final Rect mInsets = new Rect();
-
- // We have an internal and external version, and we and them together.
- private boolean mChallengeInteractiveExternal = true;
- private boolean mChallengeInteractiveInternal = true;
-
- static final Property<SlidingChallengeLayout, Float> HANDLE_ALPHA =
- new FloatProperty<SlidingChallengeLayout>("handleAlpha") {
- @Override
- public void setValue(SlidingChallengeLayout view, float value) {
- view.mHandleAlpha = value;
- view.invalidate();
- }
-
- @Override
- public Float get(SlidingChallengeLayout view) {
- return view.mHandleAlpha;
- }
- };
-
- // True if at least one layout pass has happened since the view was attached.
- private boolean mHasLayout;
-
- private static final Interpolator sMotionInterpolator = new Interpolator() {
- public float getInterpolation(float t) {
- t -= 1.0f;
- return t * t * t * t * t + 1.0f;
- }
- };
-
- private static final Interpolator sHandleFadeInterpolator = new Interpolator() {
- public float getInterpolation(float t) {
- return t * t;
- }
- };
-
- private final Runnable mEndScrollRunnable = new Runnable () {
- public void run() {
- completeChallengeScroll();
- }
- };
-
- private final OnClickListener mScrimClickListener = new OnClickListener() {
- @Override
- public void onClick(View v) {
- hideBouncer();
- }
- };
-
- private final OnClickListener mExpandChallengeClickListener = new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (!isChallengeShowing()) {
- showChallenge(true);
- }
- }
- };
-
- /**
- * Listener interface that reports changes in scroll state of the challenge area.
- */
- public interface OnChallengeScrolledListener {
- /**
- * The scroll state itself changed.
- *
- * <p>scrollState will be one of the following:</p>
- *
- * <ul>
- * <li><code>SCROLL_STATE_IDLE</code> - The challenge area is stationary.</li>
- * <li><code>SCROLL_STATE_DRAGGING</code> - The user is actively dragging
- * the challenge area.</li>
- * <li><code>SCROLL_STATE_SETTLING</code> - The challenge area is animating
- * into place.</li>
- * </ul>
- *
- * <p>Do not perform expensive operations (e.g. layout)
- * while the scroll state is not <code>SCROLL_STATE_IDLE</code>.</p>
- *
- * @param scrollState The new scroll state of the challenge area.
- */
- public void onScrollStateChanged(int scrollState);
-
- /**
- * The precise position of the challenge area has changed.
- *
- * <p>NOTE: It is NOT safe to modify layout or call any View methods that may
- * result in a requestLayout anywhere in your view hierarchy as a result of this call.
- * It may be called during drawing.</p>
- *
- * @param scrollPosition New relative position of the challenge area.
- * 1.f = fully visible/ready to be interacted with.
- * 0.f = fully invisible/inaccessible to the user.
- * @param challengeTop Position of the top edge of the challenge view in px in the
- * SlidingChallengeLayout's coordinate system.
- */
- public void onScrollPositionChanged(float scrollPosition, int challengeTop);
- }
-
- public SlidingChallengeLayout(Context context) {
- this(context, null);
- }
-
- public SlidingChallengeLayout(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public SlidingChallengeLayout(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
-
- mScroller = new Scroller(context, sMotionInterpolator);
-
- final ViewConfiguration vc = ViewConfiguration.get(context);
- mMinVelocity = vc.getScaledMinimumFlingVelocity();
- mMaxVelocity = vc.getScaledMaximumFlingVelocity();
-
- final Resources res = getResources();
- mDragHandleEdgeSlop = res.getDimensionPixelSize(R.dimen.kg_edge_swipe_region_size);
-
- mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
- mTouchSlopSquare = mTouchSlop * mTouchSlop;
-
- mDisplayMetrics = res.getDisplayMetrics();
- final float density = mDisplayMetrics.density;
-
- // top half of the lock icon, plus another 25% to be sure
- mDragHandleClosedAbove = (int) (DRAG_HANDLE_CLOSED_ABOVE * density + 0.5f);
- mDragHandleClosedBelow = (int) (DRAG_HANDLE_CLOSED_BELOW * density + 0.5f);
- mDragHandleOpenAbove = (int) (DRAG_HANDLE_OPEN_ABOVE * density + 0.5f);
- mDragHandleOpenBelow = (int) (DRAG_HANDLE_OPEN_BELOW * density + 0.5f);
-
- // how much space to account for in the handle when closed
- mChallengeBottomBound = res.getDimensionPixelSize(R.dimen.kg_widget_pager_bottom_padding);
-
- setWillNotDraw(false);
- setSystemUiVisibility(SYSTEM_UI_FLAG_LAYOUT_STABLE | SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
- }
-
- public void setEnableChallengeDragging(boolean enabled) {
- mEnableChallengeDragging = enabled;
- }
-
- public void setInsets(Rect insets) {
- mInsets.set(insets);
- }
-
- public void setHandleAlpha(float alpha) {
- if (mExpandChallengeView != null) {
- mExpandChallengeView.setAlpha(alpha);
- }
- }
-
- public void setChallengeInteractive(boolean interactive) {
- mChallengeInteractiveExternal = interactive;
- if (mExpandChallengeView != null) {
- mExpandChallengeView.setEnabled(interactive);
- }
- }
-
- void animateHandle(boolean visible) {
- if (mHandleAnimation != null) {
- mHandleAnimation.cancel();
- mHandleAnimation = null;
- }
- final float targetAlpha = visible ? 1.f : 0.f;
- if (targetAlpha == mHandleAlpha) {
- return;
- }
- mHandleAnimation = ObjectAnimator.ofFloat(this, HANDLE_ALPHA, targetAlpha);
- mHandleAnimation.setInterpolator(sHandleFadeInterpolator);
- mHandleAnimation.setDuration(HANDLE_ANIMATE_DURATION);
- mHandleAnimation.start();
- }
-
- private void sendInitialListenerUpdates() {
- if (mScrollListener != null) {
- int challengeTop = mChallengeView != null ? mChallengeView.getTop() : 0;
- mScrollListener.onScrollPositionChanged(mChallengeOffset, challengeTop);
- mScrollListener.onScrollStateChanged(mScrollState);
- }
- }
-
- public void setOnChallengeScrolledListener(OnChallengeScrolledListener listener) {
- mScrollListener = listener;
- if (mHasLayout) {
- sendInitialListenerUpdates();
- }
- }
-
- public void setOnBouncerStateChangedListener(OnBouncerStateChangedListener listener) {
- mBouncerListener = listener;
- }
-
- @Override
- public void onAttachedToWindow() {
- super.onAttachedToWindow();
-
- mHasLayout = false;
- }
-
- @Override
- public void onDetachedFromWindow() {
- super.onDetachedFromWindow();
-
- removeCallbacks(mEndScrollRunnable);
- mHasLayout = false;
- }
-
- @Override
- public void requestChildFocus(View child, View focused) {
- if (mIsBouncing && child != mChallengeView) {
- // Clear out of the bouncer if the user tries to move focus outside of
- // the security challenge view.
- hideBouncer();
- }
- super.requestChildFocus(child, focused);
- }
-
- // We want the duration of the page snap animation to be influenced by the distance that
- // the screen has to travel, however, we don't want this duration to be effected in a
- // purely linear fashion. Instead, we use this method to moderate the effect that the distance
- // of travel has on the overall snap duration.
- float distanceInfluenceForSnapDuration(float f) {
- f -= 0.5f; // center the values about 0.
- f *= 0.3f * Math.PI / 2.0f;
- return (float) Math.sin(f);
- }
-
- void setScrollState(int state) {
- if (mScrollState != state) {
- mScrollState = state;
-
- animateHandle(state == SCROLL_STATE_IDLE && !mChallengeShowing);
- if (mScrollListener != null) {
- mScrollListener.onScrollStateChanged(state);
- }
- }
- }
-
- void completeChallengeScroll() {
- setChallengeShowing(mChallengeShowingTargetState);
- mChallengeOffset = mChallengeShowing ? 1.f : 0.f;
- setScrollState(SCROLL_STATE_IDLE);
- mChallengeInteractiveInternal = true;
- mChallengeView.setLayerType(LAYER_TYPE_NONE, null);
- }
-
- void setScrimView(View scrim) {
- if (mScrimView != null) {
- mScrimView.setOnClickListener(null);
- }
- mScrimView = scrim;
- if (mScrimView != null) {
- mScrimView.setVisibility(mIsBouncing ? VISIBLE : GONE);
- mScrimView.setFocusable(true);
- mScrimView.setOnClickListener(mScrimClickListener);
- }
- }
-
- /**
- * Animate the bottom edge of the challenge view to the given position.
- *
- * @param y desired final position for the bottom edge of the challenge view in px
- * @param velocity velocity in
- */
- void animateChallengeTo(int y, int velocity) {
- if (mChallengeView == null) {
- // Nothing to do.
- return;
- }
-
- cancelTransitionsInProgress();
-
- mChallengeInteractiveInternal = false;
- enableHardwareLayerForChallengeView();
- final int sy = mChallengeView.getBottom();
- final int dy = y - sy;
- if (dy == 0) {
- completeChallengeScroll();
- return;
- }
-
- setScrollState(SCROLL_STATE_SETTLING);
-
- final int childHeight = mChallengeView.getHeight();
- final int halfHeight = childHeight / 2;
- final float distanceRatio = Math.min(1f, 1.0f * Math.abs(dy) / childHeight);
- final float distance = halfHeight + halfHeight *
- distanceInfluenceForSnapDuration(distanceRatio);
-
- int duration = 0;
- velocity = Math.abs(velocity);
- if (velocity > 0) {
- duration = 4 * Math.round(1000 * Math.abs(distance / velocity));
- } else {
- final float childDelta = (float) Math.abs(dy) / childHeight;
- duration = (int) ((childDelta + 1) * 100);
- }
- duration = Math.min(duration, MAX_SETTLE_DURATION);
-
- mScroller.startScroll(0, sy, 0, dy, duration);
- postInvalidateOnAnimation();
- }
-
- private void setChallengeShowing(boolean showChallenge) {
- if (mChallengeShowing == showChallenge) {
- return;
- }
- mChallengeShowing = showChallenge;
-
- if (mExpandChallengeView == null || mChallengeView == null) {
- // These might not be here yet if we haven't been through layout.
- // If we haven't, the first layout pass will set everything up correctly
- // based on mChallengeShowing as set above.
- return;
- }
-
- if (mChallengeShowing) {
- mExpandChallengeView.setVisibility(View.INVISIBLE);
- mChallengeView.setVisibility(View.VISIBLE);
- if (AccessibilityManager.getInstance(mContext).isEnabled()) {
- mChallengeView.requestAccessibilityFocus();
- mChallengeView.announceForAccessibility(mContext.getString(
- R.string.keyguard_accessibility_unlock_area_expanded));
- }
- } else {
- mExpandChallengeView.setVisibility(View.VISIBLE);
- mChallengeView.setVisibility(View.INVISIBLE);
- if (AccessibilityManager.getInstance(mContext).isEnabled()) {
- mExpandChallengeView.requestAccessibilityFocus();
- mChallengeView.announceForAccessibility(mContext.getString(
- R.string.keyguard_accessibility_unlock_area_collapsed));
- }
- }
- }
-
- /**
- * @return true if the challenge is at all visible.
- */
- public boolean isChallengeShowing() {
- return mChallengeShowing;
- }
-
- @Override
- public boolean isChallengeOverlapping() {
- return mChallengeShowing;
- }
-
- @Override
- public boolean isBouncing() {
- return mIsBouncing;
- }
-
- @Override
- public int getBouncerAnimationDuration() {
- return HANDLE_ANIMATE_DURATION;
- }
-
- @Override
- public void showBouncer() {
- if (mIsBouncing) return;
- setSystemUiVisibility(getSystemUiVisibility() | STATUS_BAR_DISABLE_SEARCH);
- mWasChallengeShowing = mChallengeShowing;
- mIsBouncing = true;
- showChallenge(true);
- if (mScrimView != null) {
- Animator anim = ObjectAnimator.ofFloat(mScrimView, "alpha", 1f);
- anim.setDuration(HANDLE_ANIMATE_DURATION);
- anim.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- mScrimView.setVisibility(VISIBLE);
- }
- });
- anim.start();
- }
- if (mChallengeView != null) {
- mChallengeView.showBouncer(HANDLE_ANIMATE_DURATION);
- }
-
- if (mBouncerListener != null) {
- mBouncerListener.onBouncerStateChanged(true);
- }
- }
-
- @Override
- public void hideBouncer() {
- if (!mIsBouncing) return;
- setSystemUiVisibility(getSystemUiVisibility() & ~STATUS_BAR_DISABLE_SEARCH);
- if (!mWasChallengeShowing) showChallenge(false);
- mIsBouncing = false;
-
- if (mScrimView != null) {
- Animator anim = ObjectAnimator.ofFloat(mScrimView, "alpha", 0f);
- anim.setDuration(HANDLE_ANIMATE_DURATION);
- anim.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mScrimView.setVisibility(GONE);
- }
- });
- anim.start();
- }
- if (mChallengeView != null) {
- mChallengeView.hideBouncer(HANDLE_ANIMATE_DURATION);
- }
- if (mBouncerListener != null) {
- mBouncerListener.onBouncerStateChanged(false);
- }
- }
-
- private int getChallengeMargin(boolean expanded) {
- return expanded && mHasGlowpad ? 0 : mDragHandleEdgeSlop;
- }
-
- private float getChallengeAlpha() {
- float x = mChallengeOffset - 1;
- return x * x * x + 1.f;
- }
-
- @Override
- public void requestDisallowInterceptTouchEvent(boolean allowIntercept) {
- // We'll intercept whoever we feel like! ...as long as it isn't a challenge view.
- // If there are one or more pointers in the challenge view before we take over
- // touch events, onInterceptTouchEvent will set mBlockDrag.
- }
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (mVelocityTracker == null) {
- mVelocityTracker = VelocityTracker.obtain();
- }
- mVelocityTracker.addMovement(ev);
-
- final int action = ev.getActionMasked();
- switch (action) {
- case MotionEvent.ACTION_DOWN:
- mGestureStartX = ev.getX();
- mGestureStartY = ev.getY();
- mBlockDrag = false;
- break;
-
- case MotionEvent.ACTION_CANCEL:
- case MotionEvent.ACTION_UP:
- resetTouch();
- break;
-
- case MotionEvent.ACTION_MOVE:
- final int count = ev.getPointerCount();
- for (int i = 0; i < count; i++) {
- final float x = ev.getX(i);
- final float y = ev.getY(i);
- if (!mIsBouncing && mActivePointerId == INVALID_POINTER
- && (crossedDragHandle(x, y, mGestureStartY)
- && shouldEnableChallengeDragging()
- || (isInChallengeView(x, y) &&
- mScrollState == SCROLL_STATE_SETTLING))) {
- mActivePointerId = ev.getPointerId(i);
- mGestureStartX = x;
- mGestureStartY = y;
- mGestureStartChallengeBottom = getChallengeBottom();
- mDragging = true;
- enableHardwareLayerForChallengeView();
- } else if (mChallengeShowing && isInChallengeView(x, y)
- && shouldEnableChallengeDragging()) {
- mBlockDrag = true;
- }
- }
- break;
- }
-
- if (mBlockDrag || isChallengeInteractionBlocked()) {
- mActivePointerId = INVALID_POINTER;
- mDragging = false;
- }
-
- return mDragging;
- }
-
- private boolean shouldEnableChallengeDragging() {
- return mEnableChallengeDragging || !mChallengeShowing;
- }
-
- private boolean isChallengeInteractionBlocked() {
- return !mChallengeInteractiveExternal || !mChallengeInteractiveInternal;
- }
-
- private void resetTouch() {
- mVelocityTracker.recycle();
- mVelocityTracker = null;
- mActivePointerId = INVALID_POINTER;
- mDragging = mBlockDrag = false;
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- if (mVelocityTracker == null) {
- mVelocityTracker = VelocityTracker.obtain();
- }
- mVelocityTracker.addMovement(ev);
-
- final int action = ev.getActionMasked();
- switch (action) {
- case MotionEvent.ACTION_DOWN:
- mBlockDrag = false;
- mGestureStartX = ev.getX();
- mGestureStartY = ev.getY();
- break;
-
- case MotionEvent.ACTION_CANCEL:
- if (mDragging && !isChallengeInteractionBlocked()) {
- showChallenge(0);
- }
- resetTouch();
- break;
-
- case MotionEvent.ACTION_POINTER_UP:
- if (mActivePointerId != ev.getPointerId(ev.getActionIndex())) {
- break;
- }
- case MotionEvent.ACTION_UP:
- if (mDragging && !isChallengeInteractionBlocked()) {
- mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity);
- showChallenge((int) mVelocityTracker.getYVelocity(mActivePointerId));
- }
- resetTouch();
- break;
-
- case MotionEvent.ACTION_MOVE:
- if (!mDragging && !mBlockDrag && !mIsBouncing) {
- final int count = ev.getPointerCount();
- for (int i = 0; i < count; i++) {
- final float x = ev.getX(i);
- final float y = ev.getY(i);
-
- if ((isInDragHandle(x, y) || crossedDragHandle(x, y, mGestureStartY) ||
- (isInChallengeView(x, y) && mScrollState == SCROLL_STATE_SETTLING))
- && mActivePointerId == INVALID_POINTER
- && !isChallengeInteractionBlocked()) {
- mGestureStartX = x;
- mGestureStartY = y;
- mActivePointerId = ev.getPointerId(i);
- mGestureStartChallengeBottom = getChallengeBottom();
- mDragging = true;
- enableHardwareLayerForChallengeView();
- break;
- }
- }
- }
- // Not an else; this can be set above.
- if (mDragging) {
- // No-op if already in this state, but set it here in case we arrived
- // at this point from either intercept or the above.
- setScrollState(SCROLL_STATE_DRAGGING);
-
- final int index = ev.findPointerIndex(mActivePointerId);
- if (index < 0) {
- // Oops, bogus state. We lost some touch events somewhere.
- // Just drop it with no velocity and let things settle.
- resetTouch();
- showChallenge(0);
- return true;
- }
- final float y = ev.getY(index);
- final float pos = Math.min(y - mGestureStartY,
- getLayoutBottom() - mChallengeBottomBound);
-
- moveChallengeTo(mGestureStartChallengeBottom + (int) pos);
- }
- break;
- }
- return true;
- }
-
- /**
- * The lifecycle of touch events is subtle and it's very easy to do something
- * that will cause bugs that will be nasty to track when overriding this method.
- * Normally one should always override onInterceptTouchEvent instead.
- *
- * To put it another way, don't try this at home.
- */
- @Override
- public boolean dispatchTouchEvent(MotionEvent ev) {
- final int action = ev.getActionMasked();
- boolean handled = false;
- if (action == MotionEvent.ACTION_DOWN) {
- // Defensive programming: if we didn't get the UP or CANCEL, reset anyway.
- mEdgeCaptured = false;
- }
- if (mWidgetsView != null && !mIsBouncing && (mEdgeCaptured || isEdgeSwipeBeginEvent(ev))) {
- // Normally we would need to do a lot of extra stuff here.
- // We can only get away with this because we haven't padded in
- // the widget pager or otherwise transformed it during layout.
- // We also don't support things like splitting MotionEvents.
-
- // We set handled to captured even if dispatch is returning false here so that
- // we don't send a different view a busted or incomplete event stream.
- handled = mEdgeCaptured |= mWidgetsView.dispatchTouchEvent(ev);
- }
-
- if (!handled && !mEdgeCaptured) {
- handled = super.dispatchTouchEvent(ev);
- }
-
- if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
- mEdgeCaptured = false;
- }
-
- return handled;
- }
-
- private boolean isEdgeSwipeBeginEvent(MotionEvent ev) {
- if (ev.getActionMasked() != MotionEvent.ACTION_DOWN) {
- return false;
- }
-
- final float x = ev.getX();
- return x < mDragHandleEdgeSlop || x >= getWidth() - mDragHandleEdgeSlop;
- }
-
- /**
- * We only want to add additional vertical space to the drag handle when the panel is fully
- * closed.
- */
- private int getDragHandleSizeAbove() {
- return isChallengeShowing() ? mDragHandleOpenAbove : mDragHandleClosedAbove;
- }
- private int getDragHandleSizeBelow() {
- return isChallengeShowing() ? mDragHandleOpenBelow : mDragHandleClosedBelow;
- }
-
- private boolean isInChallengeView(float x, float y) {
- return isPointInView(x, y, mChallengeView);
- }
-
- private boolean isInDragHandle(float x, float y) {
- return isPointInView(x, y, mExpandChallengeView);
- }
-
- private boolean isPointInView(float x, float y, View view) {
- if (view == null) {
- return false;
- }
- return x >= view.getLeft() && y >= view.getTop()
- && x < view.getRight() && y < view.getBottom();
- }
-
- private boolean crossedDragHandle(float x, float y, float initialY) {
-
- final int challengeTop = mChallengeView.getTop();
- final boolean horizOk = x >= 0 && x < getWidth();
-
- final boolean vertOk;
- if (mChallengeShowing) {
- vertOk = initialY < (challengeTop - getDragHandleSizeAbove()) &&
- y > challengeTop + getDragHandleSizeBelow();
- } else {
- vertOk = initialY > challengeTop + getDragHandleSizeBelow() &&
- y < challengeTop - getDragHandleSizeAbove();
- }
- return horizOk && vertOk;
- }
-
- private int makeChildMeasureSpec(int maxSize, int childDimen) {
- final int mode;
- final int size;
- switch (childDimen) {
- case LayoutParams.WRAP_CONTENT:
- mode = MeasureSpec.AT_MOST;
- size = maxSize;
- break;
- case LayoutParams.MATCH_PARENT:
- mode = MeasureSpec.EXACTLY;
- size = maxSize;
- break;
- default:
- mode = MeasureSpec.EXACTLY;
- size = Math.min(maxSize, childDimen);
- break;
- }
- return MeasureSpec.makeMeasureSpec(size, mode);
- }
-
- @Override
- protected void onMeasure(int widthSpec, int heightSpec) {
- if (MeasureSpec.getMode(widthSpec) != MeasureSpec.EXACTLY ||
- MeasureSpec.getMode(heightSpec) != MeasureSpec.EXACTLY) {
- throw new IllegalArgumentException(
- "SlidingChallengeLayout must be measured with an exact size");
- }
- final int width = MeasureSpec.getSize(widthSpec);
- final int height = MeasureSpec.getSize(heightSpec);
- setMeasuredDimension(width, height);
-
- final int insetHeight = height - mInsets.top - mInsets.bottom;
- final int insetHeightSpec = MeasureSpec.makeMeasureSpec(insetHeight, MeasureSpec.EXACTLY);
-
- // Find one and only one challenge view.
- final View oldChallengeView = mChallengeView;
- final View oldExpandChallengeView = mChallengeView;
- mChallengeView = null;
- mExpandChallengeView = null;
- final int count = getChildCount();
-
- // First iteration through the children finds special children and sets any associated
- // state.
- for (int i = 0; i < count; i++) {
- final View child = getChildAt(i);
- final LayoutParams lp = (LayoutParams) child.getLayoutParams();
- if (lp.childType == LayoutParams.CHILD_TYPE_CHALLENGE) {
- if (mChallengeView != null) {
- throw new IllegalStateException(
- "There may only be one child with layout_isChallenge=\"true\"");
- }
- if (!(child instanceof KeyguardSecurityContainer)) {
- throw new IllegalArgumentException(
- "Challenge must be a KeyguardSecurityContainer");
- }
- mChallengeView = (KeyguardSecurityContainer) child;
- if (mChallengeView != oldChallengeView) {
- mChallengeView.setVisibility(mChallengeShowing ? VISIBLE : INVISIBLE);
- }
- // We're going to play silly games with the frame's background drawable later.
- if (!mHasLayout) {
- // Set up the margin correctly based on our content for the first run.
- mHasGlowpad = child.findViewById(R.id.keyguard_selector_view) != null;
- lp.leftMargin = lp.rightMargin = getChallengeMargin(true);
- }
- } else if (lp.childType == LayoutParams.CHILD_TYPE_EXPAND_CHALLENGE_HANDLE) {
- if (mExpandChallengeView != null) {
- throw new IllegalStateException(
- "There may only be one child with layout_childType"
- + "=\"expandChallengeHandle\"");
- }
- mExpandChallengeView = child;
- if (mExpandChallengeView != oldExpandChallengeView) {
- mExpandChallengeView.setVisibility(mChallengeShowing ? INVISIBLE : VISIBLE);
- mExpandChallengeView.setOnClickListener(mExpandChallengeClickListener);
- }
- } else if (lp.childType == LayoutParams.CHILD_TYPE_SCRIM) {
- setScrimView(child);
- } else if (lp.childType == LayoutParams.CHILD_TYPE_WIDGETS) {
- mWidgetsView = child;
- }
- }
-
- // We want to measure the challenge view first, since the KeyguardWidgetPager
- // needs to do things its measure pass that are dependent on the challenge view
- // having been measured.
- if (mChallengeView != null && mChallengeView.getVisibility() != View.GONE) {
- // This one's a little funny. If the IME is present - reported in the form
- // of insets on the root view - we only give the challenge the space it would
- // have had if the IME wasn't there in order to keep the rest of the layout stable.
- // We base this on the layout_maxHeight on the challenge view. If it comes out
- // negative or zero, either we didn't have a maxHeight or we're totally out of space,
- // so give up and measure as if this rule weren't there.
- int challengeHeightSpec = insetHeightSpec;
- final View root = getRootView();
- if (root != null) {
- final LayoutParams lp = (LayoutParams) mChallengeView.getLayoutParams();
- final int windowHeight = mDisplayMetrics.heightPixels
- - root.getPaddingTop() - mInsets.top;
- final int diff = windowHeight - insetHeight;
- final int maxChallengeHeight = lp.maxHeight - diff;
- if (maxChallengeHeight > 0) {
- challengeHeightSpec = makeChildMeasureSpec(maxChallengeHeight, lp.height);
- }
- }
- measureChildWithMargins(mChallengeView, widthSpec, 0, challengeHeightSpec, 0);
- }
-
- // Measure the rest of the children
- for (int i = 0; i < count; i++) {
- final View child = getChildAt(i);
- if (child.getVisibility() == GONE) {
- continue;
- }
- // Don't measure the challenge view twice!
- if (child == mChallengeView) continue;
-
- // Measure children. Widget frame measures special, so that we can ignore
- // insets for the IME.
- int parentWidthSpec = widthSpec, parentHeightSpec = insetHeightSpec;
- final LayoutParams lp = (LayoutParams) child.getLayoutParams();
- if (lp.childType == LayoutParams.CHILD_TYPE_WIDGETS) {
- final View root = getRootView();
- if (root != null) {
- // This calculation is super dodgy and relies on several assumptions.
- // Specifically that the root of the window will be padded in for insets
- // and that the window is LAYOUT_IN_SCREEN.
- final int windowWidth = mDisplayMetrics.widthPixels;
- final int windowHeight = mDisplayMetrics.heightPixels
- - root.getPaddingTop() - mInsets.top;
- parentWidthSpec = MeasureSpec.makeMeasureSpec(
- windowWidth, MeasureSpec.EXACTLY);
- parentHeightSpec = MeasureSpec.makeMeasureSpec(
- windowHeight, MeasureSpec.EXACTLY);
- }
- } else if (lp.childType == LayoutParams.CHILD_TYPE_SCRIM) {
- // Allow scrim views to extend into the insets
- parentWidthSpec = widthSpec;
- parentHeightSpec = heightSpec;
- }
- measureChildWithMargins(child, parentWidthSpec, 0, parentHeightSpec, 0);
- }
- }
-
- @Override
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
- final int paddingLeft = getPaddingLeft();
- final int paddingTop = getPaddingTop();
- final int paddingRight = getPaddingRight();
- final int paddingBottom = getPaddingBottom();
- final int width = r - l;
- final int height = b - t;
-
- final int count = getChildCount();
- for (int i = 0; i < count; i++) {
- final View child = getChildAt(i);
-
- if (child.getVisibility() == GONE) continue;
-
- final LayoutParams lp = (LayoutParams) child.getLayoutParams();
-
- if (lp.childType == LayoutParams.CHILD_TYPE_CHALLENGE) {
- // Challenge views pin to the bottom, offset by a portion of their height,
- // and center horizontally.
- final int center = (paddingLeft + width - paddingRight) / 2;
- final int childWidth = child.getMeasuredWidth();
- final int childHeight = child.getMeasuredHeight();
- final int left = center - childWidth / 2;
- final int layoutBottom = height - paddingBottom - lp.bottomMargin - mInsets.bottom;
- // We use the top of the challenge view to position the handle, so
- // we never want less than the handle size showing at the bottom.
- final int bottom = layoutBottom + (int) ((childHeight - mChallengeBottomBound)
- * (1 - mChallengeOffset));
- child.setAlpha(getChallengeAlpha());
- child.layout(left, bottom - childHeight, left + childWidth, bottom);
- } else if (lp.childType == LayoutParams.CHILD_TYPE_EXPAND_CHALLENGE_HANDLE) {
- final int center = (paddingLeft + width - paddingRight) / 2;
- final int left = center - child.getMeasuredWidth() / 2;
- final int right = left + child.getMeasuredWidth();
- final int bottom = height - paddingBottom - lp.bottomMargin - mInsets.bottom;
- final int top = bottom - child.getMeasuredHeight();
- child.layout(left, top, right, bottom);
- } else if (lp.childType == LayoutParams.CHILD_TYPE_SCRIM) {
- // Scrim views use the entire area, including padding & insets
- child.layout(0, 0, getMeasuredWidth(), getMeasuredHeight());
- } else {
- // Non-challenge views lay out from the upper left, layered.
- child.layout(paddingLeft + lp.leftMargin,
- paddingTop + lp.topMargin + mInsets.top,
- paddingLeft + child.getMeasuredWidth(),
- paddingTop + child.getMeasuredHeight() + mInsets.top);
- }
- }
-
- if (!mHasLayout) {
- mHasLayout = true;
- }
- }
-
- @Override
- public void draw(Canvas c) {
- super.draw(c);
- if (DEBUG) {
- final Paint debugPaint = new Paint();
- debugPaint.setColor(0x40FF00CC);
- // show the isInDragHandle() rect
- c.drawRect(mDragHandleEdgeSlop,
- mChallengeView.getTop() - getDragHandleSizeAbove(),
- getWidth() - mDragHandleEdgeSlop,
- mChallengeView.getTop() + getDragHandleSizeBelow(),
- debugPaint);
- }
- }
-
- @Override
- protected boolean onRequestFocusInDescendants(int direction, Rect previouslyFocusedRect) {
- // Focus security fileds before widgets.
- if (mChallengeView != null &&
- mChallengeView.requestFocus(direction, previouslyFocusedRect)) {
- return true;
- }
- return super.onRequestFocusInDescendants(direction, previouslyFocusedRect);
- }
-
- public void computeScroll() {
- super.computeScroll();
-
- if (!mScroller.isFinished()) {
- if (mChallengeView == null) {
- // Can't scroll if the view is missing.
- Log.e(TAG, "Challenge view missing in computeScroll");
- mScroller.abortAnimation();
- return;
- }
-
- mScroller.computeScrollOffset();
- moveChallengeTo(mScroller.getCurrY());
-
- if (mScroller.isFinished()) {
- post(mEndScrollRunnable);
- }
- }
- }
-
- private void cancelTransitionsInProgress() {
- if (!mScroller.isFinished()) {
- mScroller.abortAnimation();
- completeChallengeScroll();
- }
- if (mFader != null) {
- mFader.cancel();
- }
- }
-
- public void fadeInChallenge() {
- fadeChallenge(true);
- }
-
- public void fadeOutChallenge() {
- fadeChallenge(false);
- }
-
- public void fadeChallenge(final boolean show) {
- if (mChallengeView != null) {
-
- cancelTransitionsInProgress();
- float alpha = show ? 1f : 0f;
- int duration = show ? CHALLENGE_FADE_IN_DURATION : CHALLENGE_FADE_OUT_DURATION;
- mFader = ObjectAnimator.ofFloat(mChallengeView, "alpha", alpha);
- mFader.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- onFadeStart(show);
- }
- @Override
- public void onAnimationEnd(Animator animation) {
- onFadeEnd(show);
- }
- });
- mFader.setDuration(duration);
- mFader.start();
- }
- }
-
- private int getMaxChallengeBottom() {
- if (mChallengeView == null) return 0;
- final int layoutBottom = getLayoutBottom();
- final int challengeHeight = mChallengeView.getMeasuredHeight();
-
- return (layoutBottom + challengeHeight - mChallengeBottomBound);
- }
-
- private int getMinChallengeBottom() {
- return getLayoutBottom();
- }
-
-
- private void onFadeStart(boolean show) {
- mChallengeInteractiveInternal = false;
- enableHardwareLayerForChallengeView();
-
- if (show) {
- moveChallengeTo(getMinChallengeBottom());
- }
-
- setScrollState(SCROLL_STATE_FADING);
- }
-
- private void enableHardwareLayerForChallengeView() {
- if (mChallengeView.isHardwareAccelerated()) {
- mChallengeView.setLayerType(LAYER_TYPE_HARDWARE, null);
- }
- }
-
- private void onFadeEnd(boolean show) {
- mChallengeInteractiveInternal = true;
- setChallengeShowing(show);
-
- if (!show) {
- moveChallengeTo(getMaxChallengeBottom());
- }
-
- mChallengeView.setLayerType(LAYER_TYPE_NONE, null);
- mFader = null;
- setScrollState(SCROLL_STATE_IDLE);
- }
-
- public int getMaxChallengeTop() {
- if (mChallengeView == null) return 0;
-
- final int layoutBottom = getLayoutBottom();
- final int challengeHeight = mChallengeView.getMeasuredHeight();
- return layoutBottom - challengeHeight - mInsets.top;
- }
-
- /**
- * Move the bottom edge of mChallengeView to a new position and notify the listener
- * if it represents a change in position. Changes made through this method will
- * be stable across layout passes. If this method is called before first layout of
- * this SlidingChallengeLayout it will have no effect.
- *
- * @param bottom New bottom edge in px in this SlidingChallengeLayout's coordinate system.
- * @return true if the challenge view was moved
- */
- private boolean moveChallengeTo(int bottom) {
- if (mChallengeView == null || !mHasLayout) {
- return false;
- }
-
- final int layoutBottom = getLayoutBottom();
- final int challengeHeight = mChallengeView.getHeight();
-
- bottom = Math.max(getMinChallengeBottom(),
- Math.min(bottom, getMaxChallengeBottom()));
-
- float offset = 1.f - (float) (bottom - layoutBottom) /
- (challengeHeight - mChallengeBottomBound);
- mChallengeOffset = offset;
- if (offset > 0 && !mChallengeShowing) {
- setChallengeShowing(true);
- }
-
- mChallengeView.layout(mChallengeView.getLeft(),
- bottom - mChallengeView.getHeight(), mChallengeView.getRight(), bottom);
-
- mChallengeView.setAlpha(getChallengeAlpha());
- if (mScrollListener != null) {
- mScrollListener.onScrollPositionChanged(offset, mChallengeView.getTop());
- }
- postInvalidateOnAnimation();
- return true;
- }
-
- /**
- * The bottom edge of this SlidingChallengeLayout's coordinate system; will coincide with
- * the bottom edge of mChallengeView when the challenge is fully opened.
- */
- private int getLayoutBottom() {
- final int bottomMargin = (mChallengeView == null)
- ? 0
- : ((LayoutParams) mChallengeView.getLayoutParams()).bottomMargin;
- final int layoutBottom = getMeasuredHeight() - getPaddingBottom() - bottomMargin
- - mInsets.bottom;
- return layoutBottom;
- }
-
- /**
- * The bottom edge of mChallengeView; essentially, where the sliding challenge 'is'.
- */
- private int getChallengeBottom() {
- if (mChallengeView == null) return 0;
-
- return mChallengeView.getBottom();
- }
-
- /**
- * Show or hide the challenge view, animating it if necessary.
- * @param show true to show, false to hide
- */
- public void showChallenge(boolean show) {
- showChallenge(show, 0);
- if (!show) {
- // Block any drags in progress so that callers can use this to disable dragging
- // for other touch interactions.
- mBlockDrag = true;
- }
- }
-
- private void showChallenge(int velocity) {
- boolean show = false;
- if (Math.abs(velocity) > mMinVelocity) {
- show = velocity < 0;
- } else {
- show = mChallengeOffset >= 0.5f;
- }
- showChallenge(show, velocity);
- }
-
- private void showChallenge(boolean show, int velocity) {
- if (mChallengeView == null) {
- setChallengeShowing(false);
- return;
- }
-
- if (mHasLayout) {
- mChallengeShowingTargetState = show;
- final int layoutBottom = getLayoutBottom();
- animateChallengeTo(show ? layoutBottom :
- layoutBottom + mChallengeView.getHeight() - mChallengeBottomBound, velocity);
- }
- }
-
- @Override
- public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs) {
- return new LayoutParams(getContext(), attrs);
- }
-
- @Override
- protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
- return p instanceof LayoutParams ? new LayoutParams((LayoutParams) p) :
- p instanceof MarginLayoutParams ? new LayoutParams((MarginLayoutParams) p) :
- new LayoutParams(p);
- }
-
- @Override
- protected ViewGroup.LayoutParams generateDefaultLayoutParams() {
- return new LayoutParams();
- }
-
- @Override
- protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
- return p instanceof LayoutParams;
- }
-
- public static class LayoutParams extends MarginLayoutParams {
- public int childType = CHILD_TYPE_NONE;
- public static final int CHILD_TYPE_NONE = 0;
- public static final int CHILD_TYPE_CHALLENGE = 2;
- public static final int CHILD_TYPE_SCRIM = 4;
- public static final int CHILD_TYPE_WIDGETS = 5;
- public static final int CHILD_TYPE_EXPAND_CHALLENGE_HANDLE = 6;
-
- public int maxHeight;
-
- public LayoutParams() {
- this(MATCH_PARENT, WRAP_CONTENT);
- }
-
- public LayoutParams(int width, int height) {
- super(width, height);
- }
-
- public LayoutParams(android.view.ViewGroup.LayoutParams source) {
- super(source);
- }
-
- public LayoutParams(MarginLayoutParams source) {
- super(source);
- }
-
- public LayoutParams(LayoutParams source) {
- super(source);
-
- childType = source.childType;
- }
-
- public LayoutParams(Context c, AttributeSet attrs) {
- super(c, attrs);
-
- final TypedArray a = c.obtainStyledAttributes(attrs,
- R.styleable.SlidingChallengeLayout_Layout);
- childType = a.getInt(R.styleable.SlidingChallengeLayout_Layout_layout_childType,
- CHILD_TYPE_NONE);
- maxHeight = a.getDimensionPixelSize(
- R.styleable.SlidingChallengeLayout_Layout_layout_maxHeight, 0);
- a.recycle();
- }
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java b/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java
index ab69a0c..f327078 100644
--- a/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java
+++ b/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java
@@ -47,12 +47,6 @@
void setNeedsInput(boolean needsInput);
/**
- * Tell view mediator that the keyguard view's desired user activity timeout
- * has changed and needs to be reapplied to the window.
- */
- void onUserActivityTimeoutChanged();
-
- /**
* Report that the keyguard is dismissable, pending the next keyguardDone call.
*/
void keyguardDonePending();
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index b606a6f..035bb0e 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -173,18 +173,6 @@
android:excludeFromRecents="true">
</activity>
- <activity android:name=".recent.RecentsActivity"
- android:label="@string/accessibility_desc_recent_apps"
- android:theme="@style/RecentsStyle"
- android:excludeFromRecents="true"
- android:launchMode="singleInstance"
- android:resumeWhilePausing="true"
- android:exported="true">
- <intent-filter>
- <action android:name="com.android.systemui.TOGGLE_RECENTS" />
- </intent-filter>
- </activity>
-
<receiver
android:name=".recent.RecentsPreloadReceiver"
android:exported="false">
diff --git a/packages/SystemUI/res/anim/notification_buttons_in.xml b/packages/SystemUI/res/anim/notification_buttons_in.xml
deleted file mode 100644
index 630fd72..0000000
--- a/packages/SystemUI/res/anim/notification_buttons_in.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- >
- <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
- android:duration="@android:integer/config_longAnimTime"
- />
-</set>
diff --git a/packages/SystemUI/res/anim/notification_buttons_out.xml b/packages/SystemUI/res/anim/notification_buttons_out.xml
deleted file mode 100644
index 4717e47..0000000
--- a/packages/SystemUI/res/anim/notification_buttons_out.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- >
- <alpha android:toAlpha="0.0" android:fromAlpha="1.0"
- android:duration="@android:integer/config_longAnimTime"
- />
-</set>
diff --git a/packages/SystemUI/res/anim/notification_icons_in.xml b/packages/SystemUI/res/anim/notification_icons_in.xml
deleted file mode 100644
index 630fd72..0000000
--- a/packages/SystemUI/res/anim/notification_icons_in.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- >
- <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
- android:duration="@android:integer/config_longAnimTime"
- />
-</set>
diff --git a/packages/SystemUI/res/anim/notification_icons_out.xml b/packages/SystemUI/res/anim/notification_icons_out.xml
deleted file mode 100644
index 4717e47..0000000
--- a/packages/SystemUI/res/anim/notification_icons_out.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- >
- <alpha android:toAlpha="0.0" android:fromAlpha="1.0"
- android:duration="@android:integer/config_longAnimTime"
- />
-</set>
diff --git a/packages/SystemUI/res/anim/recent_appear.xml b/packages/SystemUI/res/anim/recent_appear.xml
deleted file mode 100644
index 4400d9d..0000000
--- a/packages/SystemUI/res/anim/recent_appear.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<alpha xmlns:android="http://schemas.android.com/apk/res/android"
- android:fromAlpha="0.0" android:toAlpha="1.0"
- android:duration="@android:integer/config_shortAnimTime"
- />
diff --git a/packages/SystemUI/res/drawable-hdpi/bg_protect.9.png b/packages/SystemUI/res/drawable-hdpi/bg_protect.9.png
deleted file mode 100644
index 5bbfa4f..0000000
--- a/packages/SystemUI/res/drawable-hdpi/bg_protect.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/bottom_divider_glow.png b/packages/SystemUI/res/drawable-hdpi/bottom_divider_glow.png
deleted file mode 100644
index d1948d6..0000000
--- a/packages/SystemUI/res/drawable-hdpi/bottom_divider_glow.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_lockscreen_glowdot.png b/packages/SystemUI/res/drawable-hdpi/ic_lockscreen_glowdot.png
deleted file mode 100644
index 983c45e..0000000
--- a/packages/SystemUI/res/drawable-hdpi/ic_lockscreen_glowdot.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_alarm_on.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_alarm_on.png
deleted file mode 100644
index c100353..0000000
--- a/packages/SystemUI/res/drawable-hdpi/ic_qs_alarm_on.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_certificate_info.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_certificate_info.png
deleted file mode 100644
index 1fdaaf9..0000000
--- a/packages/SystemUI/res/drawable-hdpi/ic_qs_certificate_info.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_ime.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_ime.png
deleted file mode 100644
index e3b3eeb..0000000
--- a/packages/SystemUI/res/drawable-hdpi/ic_qs_ime.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_settings.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_settings.png
deleted file mode 100644
index cfa539f..0000000
--- a/packages/SystemUI/res/drawable-hdpi/ic_qs_settings.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_usb_device.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_usb_device.png
deleted file mode 100644
index c3f4729..0000000
--- a/packages/SystemUI/res/drawable-hdpi/ic_qs_usb_device.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-hdpi/notification_panel_bg.9.png
deleted file mode 100644
index ff0bd4c..0000000
--- a/packages/SystemUI/res/drawable-hdpi/notification_panel_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg.9.png b/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg.9.png
deleted file mode 100644
index d000f7e..0000000
--- a/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg_normal.9.png b/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg_normal.9.png
deleted file mode 100644
index 8b45500..0000000
--- a/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg_normal.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg_press.9.png b/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg_press.9.png
deleted file mode 100644
index cbcb3e3..0000000
--- a/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg_press.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/spinner_default_holo_dark_am_no_underline.9.png b/packages/SystemUI/res/drawable-hdpi/spinner_default_holo_dark_am_no_underline.9.png
deleted file mode 100644
index 267e7ba..0000000
--- a/packages/SystemUI/res/drawable-hdpi/spinner_default_holo_dark_am_no_underline.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_roaming_cdma_0.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_roaming_cdma_0.png
deleted file mode 100644
index 8f17b72..0000000
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_roaming_cdma_0.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_sync.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_sync.png
deleted file mode 100644
index 2dc2b17..0000000
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_sync.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/status_bar_close_off.9.png b/packages/SystemUI/res/drawable-hdpi/status_bar_close_off.9.png
deleted file mode 100644
index 6feb622..0000000
--- a/packages/SystemUI/res/drawable-hdpi/status_bar_close_off.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/status_bar_close_on.9.png b/packages/SystemUI/res/drawable-hdpi/status_bar_close_on.9.png
deleted file mode 100644
index 42c773d..0000000
--- a/packages/SystemUI/res/drawable-hdpi/status_bar_close_on.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/top_divider_glow.png b/packages/SystemUI/res/drawable-hdpi/top_divider_glow.png
deleted file mode 100644
index a540efb1..0000000
--- a/packages/SystemUI/res/drawable-hdpi/top_divider_glow.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-land-hdpi/bg_protect.9.png b/packages/SystemUI/res/drawable-land-hdpi/bg_protect.9.png
deleted file mode 100644
index 1a58144..0000000
--- a/packages/SystemUI/res/drawable-land-hdpi/bg_protect.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-land-mdpi/bg_protect.9.png b/packages/SystemUI/res/drawable-land-mdpi/bg_protect.9.png
deleted file mode 100644
index a12519e..0000000
--- a/packages/SystemUI/res/drawable-land-mdpi/bg_protect.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-land-xhdpi/bg_protect.9.png b/packages/SystemUI/res/drawable-land-xhdpi/bg_protect.9.png
deleted file mode 100644
index ce41454..0000000
--- a/packages/SystemUI/res/drawable-land-xhdpi/bg_protect.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-land-xxhdpi/bg_protect.9.png b/packages/SystemUI/res/drawable-land-xxhdpi/bg_protect.9.png
deleted file mode 100644
index b0b4561..0000000
--- a/packages/SystemUI/res/drawable-land-xxhdpi/bg_protect.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_default_user.png b/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_default_user.png
deleted file mode 100644
index 54afe32..0000000
--- a/packages/SystemUI/res/drawable-ldrtl-hdpi/ic_qs_default_user.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_default_user.png b/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_default_user.png
deleted file mode 100644
index 2495830..0000000
--- a/packages/SystemUI/res/drawable-ldrtl-mdpi/ic_qs_default_user.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_default_user.png b/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_default_user.png
deleted file mode 100644
index 0d5b50c..0000000
--- a/packages/SystemUI/res/drawable-ldrtl-xhdpi/ic_qs_default_user.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-ldrtl-xxhdpi/ic_qs_default_user.png b/packages/SystemUI/res/drawable-ldrtl-xxhdpi/ic_qs_default_user.png
deleted file mode 100644
index 07f16c3..0000000
--- a/packages/SystemUI/res/drawable-ldrtl-xxhdpi/ic_qs_default_user.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/bg_protect.9.png b/packages/SystemUI/res/drawable-mdpi/bg_protect.9.png
deleted file mode 100644
index 2856e09..0000000
--- a/packages/SystemUI/res/drawable-mdpi/bg_protect.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/bottom_divider_glow.png b/packages/SystemUI/res/drawable-mdpi/bottom_divider_glow.png
deleted file mode 100644
index ba25f65..0000000
--- a/packages/SystemUI/res/drawable-mdpi/bottom_divider_glow.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_lockscreen_glowdot.png b/packages/SystemUI/res/drawable-mdpi/ic_lockscreen_glowdot.png
deleted file mode 100644
index 056c3f17..0000000
--- a/packages/SystemUI/res/drawable-mdpi/ic_lockscreen_glowdot.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_alarm_on.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_alarm_on.png
deleted file mode 100644
index 27f08dd..0000000
--- a/packages/SystemUI/res/drawable-mdpi/ic_qs_alarm_on.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_certificate_info.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_certificate_info.png
deleted file mode 100644
index 3b49472..0000000
--- a/packages/SystemUI/res/drawable-mdpi/ic_qs_certificate_info.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_ime.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_ime.png
deleted file mode 100644
index cc81794..0000000
--- a/packages/SystemUI/res/drawable-mdpi/ic_qs_ime.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_settings.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_settings.png
deleted file mode 100644
index e6237eb..0000000
--- a/packages/SystemUI/res/drawable-mdpi/ic_qs_settings.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_usb_device.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_usb_device.png
deleted file mode 100644
index 19b95dd..0000000
--- a/packages/SystemUI/res/drawable-mdpi/ic_qs_usb_device.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-mdpi/notification_panel_bg.9.png
deleted file mode 100644
index 2bbb2c6..0000000
--- a/packages/SystemUI/res/drawable-mdpi/notification_panel_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg.9.png b/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg.9.png
deleted file mode 100644
index f19dc93..0000000
--- a/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg_normal.9.png b/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg_normal.9.png
deleted file mode 100644
index 4b7de52..0000000
--- a/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg_normal.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg_press.9.png b/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg_press.9.png
deleted file mode 100644
index 3ac7c40..0000000
--- a/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg_press.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/spinner_default_holo_dark_am_no_underline.9.png b/packages/SystemUI/res/drawable-mdpi/spinner_default_holo_dark_am_no_underline.9.png
deleted file mode 100644
index db51f6b..0000000
--- a/packages/SystemUI/res/drawable-mdpi/spinner_default_holo_dark_am_no_underline.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_roaming_cdma_0.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_roaming_cdma_0.png
deleted file mode 100644
index cb38896..0000000
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_roaming_cdma_0.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_sync.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_sync.png
deleted file mode 100644
index ad5b2ff..0000000
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_sync.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/status_bar_close_off.9.png b/packages/SystemUI/res/drawable-mdpi/status_bar_close_off.9.png
deleted file mode 100644
index bd1cd12..0000000
--- a/packages/SystemUI/res/drawable-mdpi/status_bar_close_off.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/status_bar_close_on.9.png b/packages/SystemUI/res/drawable-mdpi/status_bar_close_on.9.png
deleted file mode 100644
index 20c8785..0000000
--- a/packages/SystemUI/res/drawable-mdpi/status_bar_close_on.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/top_divider_glow.png b/packages/SystemUI/res/drawable-mdpi/top_divider_glow.png
deleted file mode 100644
index 53d85de..0000000
--- a/packages/SystemUI/res/drawable-mdpi/top_divider_glow.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-nodpi/bugdroid.png b/packages/SystemUI/res/drawable-nodpi/bugdroid.png
deleted file mode 100644
index b90675c..0000000
--- a/packages/SystemUI/res/drawable-nodpi/bugdroid.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-nodpi/notify_item_glow_bottom.png b/packages/SystemUI/res/drawable-nodpi/notify_item_glow_bottom.png
deleted file mode 100644
index e7828c9..0000000
--- a/packages/SystemUI/res/drawable-nodpi/notify_item_glow_bottom.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-sw600dp-hdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/notification_panel_bg.9.png
deleted file mode 100644
index e7caeda..0000000
--- a/packages/SystemUI/res/drawable-sw600dp-hdpi/notification_panel_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-sw600dp-mdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/notification_panel_bg.9.png
deleted file mode 100644
index ae07083..0000000
--- a/packages/SystemUI/res/drawable-sw600dp-mdpi/notification_panel_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-sw600dp-tvdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-sw600dp-tvdpi/notification_panel_bg.9.png
deleted file mode 100644
index 727ee49..0000000
--- a/packages/SystemUI/res/drawable-sw600dp-tvdpi/notification_panel_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-sw600dp-xhdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-sw600dp-xhdpi/notification_panel_bg.9.png
deleted file mode 100644
index 8423ef9..0000000
--- a/packages/SystemUI/res/drawable-sw600dp-xhdpi/notification_panel_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-sw600dp-xxhdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-sw600dp-xxhdpi/notification_panel_bg.9.png
deleted file mode 100644
index 8703e1d..0000000
--- a/packages/SystemUI/res/drawable-sw600dp-xxhdpi/notification_panel_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-tvdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-tvdpi/notification_panel_bg.9.png
deleted file mode 100644
index c3a105c..0000000
--- a/packages/SystemUI/res/drawable-tvdpi/notification_panel_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/bg_protect.9.png b/packages/SystemUI/res/drawable-xhdpi/bg_protect.9.png
deleted file mode 100644
index 72269f2..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/bg_protect.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/bottom_divider_glow.png b/packages/SystemUI/res/drawable-xhdpi/bottom_divider_glow.png
deleted file mode 100644
index 0b012b4..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/bottom_divider_glow.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_lockscreen_glowdot.png b/packages/SystemUI/res/drawable-xhdpi/ic_lockscreen_glowdot.png
deleted file mode 100644
index cbd039a..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/ic_lockscreen_glowdot.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_alarm_on.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_alarm_on.png
deleted file mode 100644
index 3c0eac1..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/ic_qs_alarm_on.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_certificate_info.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_certificate_info.png
deleted file mode 100644
index b3de2ce..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/ic_qs_certificate_info.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_ime.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_ime.png
deleted file mode 100644
index 65d15b5..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/ic_qs_ime.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_settings.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_settings.png
deleted file mode 100644
index 208089d..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/ic_qs_settings.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_usb_device.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_usb_device.png
deleted file mode 100644
index 86de480..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/ic_qs_usb_device.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-xhdpi/notification_panel_bg.9.png
deleted file mode 100644
index 932e0ef..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/notification_panel_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/recents_thumbnail_bg.9.png b/packages/SystemUI/res/drawable-xhdpi/recents_thumbnail_bg.9.png
deleted file mode 100644
index 80fc849..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/recents_thumbnail_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/recents_thumbnail_bg_normal.9.png b/packages/SystemUI/res/drawable-xhdpi/recents_thumbnail_bg_normal.9.png
deleted file mode 100644
index c57ec67..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/recents_thumbnail_bg_normal.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/recents_thumbnail_bg_press.9.png b/packages/SystemUI/res/drawable-xhdpi/recents_thumbnail_bg_press.9.png
deleted file mode 100644
index 78a69f5..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/recents_thumbnail_bg_press.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/spinner_default_holo_dark_am_no_underline.9.png b/packages/SystemUI/res/drawable-xhdpi/spinner_default_holo_dark_am_no_underline.9.png
deleted file mode 100644
index 8d22ce2..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/spinner_default_holo_dark_am_no_underline.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/stat_sys_roaming_cdma_0.png b/packages/SystemUI/res/drawable-xhdpi/stat_sys_roaming_cdma_0.png
deleted file mode 100644
index f0c2f05..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/stat_sys_roaming_cdma_0.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/stat_sys_sync.png b/packages/SystemUI/res/drawable-xhdpi/stat_sys_sync.png
deleted file mode 100644
index 75b002d..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/stat_sys_sync.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/status_bar_close_off.9.png b/packages/SystemUI/res/drawable-xhdpi/status_bar_close_off.9.png
deleted file mode 100644
index 1fed081..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/status_bar_close_off.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/status_bar_close_on.9.png b/packages/SystemUI/res/drawable-xhdpi/status_bar_close_on.9.png
deleted file mode 100644
index b4e129c..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/status_bar_close_on.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/top_divider_glow.png b/packages/SystemUI/res/drawable-xhdpi/top_divider_glow.png
deleted file mode 100644
index d4526c0..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/top_divider_glow.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/bg_protect.9.png b/packages/SystemUI/res/drawable-xxhdpi/bg_protect.9.png
deleted file mode 100644
index efc9b04..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/bg_protect.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_lockscreen_glowdot.png b/packages/SystemUI/res/drawable-xxhdpi/ic_lockscreen_glowdot.png
deleted file mode 100644
index c0edd91..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/ic_lockscreen_glowdot.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_alarm_on.png b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_alarm_on.png
deleted file mode 100644
index 1e8509b..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_alarm_on.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_certificate_info.png b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_certificate_info.png
deleted file mode 100644
index 5d6f6c7..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_certificate_info.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_ime.png b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_ime.png
deleted file mode 100644
index 1a5d26a..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_ime.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_settings.png b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_settings.png
deleted file mode 100644
index 452942e..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_settings.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_usb_device.png b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_usb_device.png
deleted file mode 100644
index 99abb6a..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_usb_device.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/notification_panel_bg.9.png b/packages/SystemUI/res/drawable-xxhdpi/notification_panel_bg.9.png
deleted file mode 100644
index adcdcb7..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/notification_panel_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/recents_thumbnail_bg.9.png b/packages/SystemUI/res/drawable-xxhdpi/recents_thumbnail_bg.9.png
deleted file mode 100644
index a446448..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/recents_thumbnail_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/recents_thumbnail_bg_normal.9.png b/packages/SystemUI/res/drawable-xxhdpi/recents_thumbnail_bg_normal.9.png
deleted file mode 100644
index a446448..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/recents_thumbnail_bg_normal.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/recents_thumbnail_bg_press.9.png b/packages/SystemUI/res/drawable-xxhdpi/recents_thumbnail_bg_press.9.png
deleted file mode 100644
index 1fa1e62..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/recents_thumbnail_bg_press.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/spinner_default_holo_dark_am_no_underline.9.png b/packages/SystemUI/res/drawable-xxhdpi/spinner_default_holo_dark_am_no_underline.9.png
deleted file mode 100644
index 29fb50f..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/spinner_default_holo_dark_am_no_underline.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/stat_sys_roaming_cdma_0.png b/packages/SystemUI/res/drawable-xxhdpi/stat_sys_roaming_cdma_0.png
deleted file mode 100644
index 1c544c47..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/stat_sys_roaming_cdma_0.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/stat_sys_sync.png b/packages/SystemUI/res/drawable-xxhdpi/stat_sys_sync.png
deleted file mode 100644
index 99b2fff..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/stat_sys_sync.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/status_bar_close_off.9.png b/packages/SystemUI/res/drawable-xxhdpi/status_bar_close_off.9.png
deleted file mode 100644
index d50ff85..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/status_bar_close_off.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/status_bar_close_on.9.png b/packages/SystemUI/res/drawable-xxhdpi/status_bar_close_on.9.png
deleted file mode 100644
index 5d27ccd..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/status_bar_close_on.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable/navbar_search_outerring.xml b/packages/SystemUI/res/drawable/navbar_search_outerring.xml
deleted file mode 100644
index 689dbf0..0000000
--- a/packages/SystemUI/res/drawable/navbar_search_outerring.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="oval">
- <size android:height="@dimen/navbar_search_outerring_diameter"
- android:width="@dimen/navbar_search_outerring_diameter" />
- <solid android:color="#00000000" />
- <stroke android:color="#40ffffff" android:width="2dp" />
-</shape>
diff --git a/packages/SystemUI/res/drawable/notification_list_shadow.xml b/packages/SystemUI/res/drawable/notification_list_shadow.xml
deleted file mode 100644
index 7f33153..0000000
--- a/packages/SystemUI/res/drawable/notification_list_shadow.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<shape
- xmlns:android="http://schemas.android.com/apk/res/android"
- >
- <gradient
- android:angle="90"
- android:endColor="@color/notification_list_shadow_top"
- android:startColor="#00000000"
- android:type="linear"
- />
-</shape>
diff --git a/packages/SystemUI/res/drawable/notification_scrim.xml b/packages/SystemUI/res/drawable/notification_scrim.xml
deleted file mode 100644
index 53ba213..0000000
--- a/packages/SystemUI/res/drawable/notification_scrim.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- ~ Copyright (C) 2014 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-
-<shape xmlns:android="http://schemas.android.com/apk/res/android">
- <solid android:color="#08000000" />
- <corners android:radius="@dimen/notification_material_rounded_rect_radius" />
-</shape>
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/recents_thumbnail_fg.xml b/packages/SystemUI/res/drawable/recents_thumbnail_fg.xml
deleted file mode 100644
index c209055..0000000
--- a/packages/SystemUI/res/drawable/recents_thumbnail_fg.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/recents_thumbnail_bg_press" android:state_selected="true" />
- <item android:drawable="@drawable/recents_thumbnail_bg_press" android:state_pressed="true" />
- <item android:drawable="@drawable/recents_thumbnail_no_press"/>
-</selector>
diff --git a/packages/SystemUI/res/drawable/recents_thumbnail_no_press.xml b/packages/SystemUI/res/drawable/recents_thumbnail_no_press.xml
deleted file mode 100644
index be07b2c..0000000
--- a/packages/SystemUI/res/drawable/recents_thumbnail_no_press.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<color xmlns:android="http://schemas.android.com/apk/res/android"
- android:color="#00000000" />
diff --git a/packages/SystemUI/res/drawable/status_bar_close.xml b/packages/SystemUI/res/drawable/status_bar_close.xml
deleted file mode 100644
index 2efc3c3a..0000000
--- a/packages/SystemUI/res/drawable/status_bar_close.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
- android:drawable="@drawable/status_bar_close_on" />
- <item
- android:drawable="@drawable/status_bar_close_off" />
-</selector>
-
diff --git a/packages/SystemUI/res/drawable/status_bar_recents_background.xml b/packages/SystemUI/res/drawable/status_bar_recents_background.xml
deleted file mode 100644
index ea0b75c..0000000
--- a/packages/SystemUI/res/drawable/status_bar_recents_background.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-<shape xmlns:android="http://schemas.android.com/apk/res/android">
- <gradient name="status_bar_recents_background"
- android:startColor="#E0000000"
- android:endColor="#99000000"
- android:angle="@integer/status_bar_recents_bg_gradient_degrees"
- />
-</shape>
diff --git a/packages/SystemUI/res/drawable/status_bar_settings_slider_disabled.xml b/packages/SystemUI/res/drawable/status_bar_settings_slider_disabled.xml
deleted file mode 100644
index 17d48b7..0000000
--- a/packages/SystemUI/res/drawable/status_bar_settings_slider_disabled.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@android:id/background"
- android:drawable="@*android:drawable/scrubber_track_holo_dark" />
- <item android:id="@android:id/secondaryProgress">
- <scale android:scaleWidth="100%"
- android:drawable="@*android:drawable/scrubber_track_holo_dark" />
- </item>
- <item android:id="@android:id/progress">
- <scale android:scaleWidth="100%"
- android:drawable="@*android:drawable/scrubber_track_holo_dark" />
- </item>
-</layer-list>
-
diff --git a/packages/SystemUI/res/drawable/status_bar_toggle_button.xml b/packages/SystemUI/res/drawable/status_bar_toggle_button.xml
deleted file mode 100644
index e17c62f..0000000
--- a/packages/SystemUI/res/drawable/status_bar_toggle_button.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_checked="true"
- android:drawable="@*android:drawable/scrubber_primary_holo" />
- <item
- android:drawable="@*android:drawable/scrubber_track_holo_dark" />
-</selector>
-
diff --git a/packages/SystemUI/res/drawable/system_bar_notification_header_bg.xml b/packages/SystemUI/res/drawable/system_bar_notification_header_bg.xml
deleted file mode 100644
index 85f1ea2..0000000
--- a/packages/SystemUI/res/drawable/system_bar_notification_header_bg.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true" android:drawable="@*android:drawable/list_selector_pressed_holo_dark" />
- <item android:drawable="@*android:drawable/list_selector_disabled_holo_dark" />
-</selector>
diff --git a/packages/SystemUI/res/layout-land/status_bar_recent_item.xml b/packages/SystemUI/res/layout-land/status_bar_recent_item.xml
deleted file mode 100644
index 1257641..0000000
--- a/packages/SystemUI/res/layout-land/status_bar_recent_item.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* apps/common/assets/default/default/skins/StatusBar.xml
-**
-** Copyright 2006, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="match_parent"
- android:layout_width="wrap_content"
- android:paddingStart="@dimen/status_bar_recents_item_padding"
- android:paddingEnd="@dimen/status_bar_recents_item_padding"
- android:importantForAccessibility="no"
- android:clipChildren="false">
-
- <RelativeLayout android:id="@+id/recent_item"
- android:layout_gravity="center_vertical"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:paddingTop="@*android:dimen/status_bar_height"
- android:clipChildren="false"
- android:clipToPadding="false">
-
- <FrameLayout android:id="@+id/app_thumbnail"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentStart="true"
- android:layout_alignParentTop="true"
- android:layout_marginTop="@dimen/status_bar_recents_thumbnail_top_margin"
- android:layout_marginStart="@dimen/status_bar_recents_thumbnail_left_margin"
- android:background="@drawable/recents_thumbnail_bg"
- android:foreground="@drawable/recents_thumbnail_fg"
- android:visibility="invisible">
- <ImageView android:id="@+id/app_thumbnail_image"
- android:layout_width="@dimen/status_bar_recents_thumbnail_width"
- android:layout_height="@dimen/status_bar_recents_thumbnail_height"
- />
- </FrameLayout>
-
- <ImageView android:id="@+id/app_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/status_bar_recents_app_icon_top_margin"
- android:layout_marginStart="@dimen/status_bar_recents_app_icon_left_margin"
- android:layout_alignParentStart="true"
- android:layout_alignParentTop="true"
- android:maxWidth="@dimen/status_bar_recents_app_icon_max_width"
- android:maxHeight="@dimen/status_bar_recents_app_icon_max_height"
- android:scaleType="centerInside"
- android:adjustViewBounds="true"
- android:visibility="invisible"
- />
-
- <TextView android:id="@+id/app_label"
- android:layout_width="@dimen/status_bar_recents_app_label_width"
- android:layout_height="wrap_content"
- android:textSize="@dimen/status_bar_recents_app_label_text_size"
- android:fadingEdge="horizontal"
- android:fadingEdgeLength="@dimen/status_bar_recents_text_fading_edge_length"
- android:scrollHorizontally="true"
- android:layout_alignStart="@id/app_thumbnail"
- android:layout_below="@id/app_thumbnail"
- android:layout_marginTop="@dimen/status_bar_recents_text_description_padding"
- android:layout_marginStart="@dimen/status_bar_recents_app_label_left_margin"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textColor="@color/status_bar_recents_app_label_color"
- android:importantForAccessibility="no"
- />
-
- <TextView android:id="@+id/app_description"
- android:layout_width="@dimen/status_bar_recents_app_label_width"
- android:layout_height="wrap_content"
- android:textSize="@dimen/status_bar_recents_app_description_text_size"
- android:fadingEdge="horizontal"
- android:fadingEdgeLength="@dimen/status_bar_recents_text_fading_edge_length"
- android:scrollHorizontally="true"
- android:layout_alignStart="@id/app_thumbnail"
- android:layout_below="@id/app_label"
- android:layout_marginTop="@dimen/status_bar_recents_text_description_padding"
- android:singleLine="true"
- android:ellipsize="marquee"
- />
-
- </RelativeLayout>
-</FrameLayout>
diff --git a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
deleted file mode 100644
index b5d2f86..0000000
--- a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* apps/common/assets/default/default/skins/StatusBar.xml
-**
-** Copyright 2010, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<com.android.systemui.recent.RecentsPanelView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res-auto"
- android:id="@+id/recents_root"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:foreground="@drawable/bg_protect"
- systemui:recentItemLayout="@layout/status_bar_recent_item"
- >
- <FrameLayout
- android:id="@+id/recents_bg_protect"
- android:background="@drawable/status_bar_recents_background"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_alignParentBottom="true"
- android:clipToPadding="false"
- android:clipChildren="false">
-
- <com.android.systemui.recent.RecentsHorizontalScrollView android:id="@+id/recents_container"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:fadingEdge="horizontal"
- android:scrollbars="none"
- android:layout_gravity="right"
- android:fadingEdgeLength="@dimen/status_bar_recents_scroll_fading_edge_length">
-
- <LinearLayout android:id="@+id/recents_linear_layout"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layoutDirection="ltr"
- android:layout_gravity="left"
- android:orientation="horizontal"
- android:fitsSystemWindows="true">
- </LinearLayout>
-
- </com.android.systemui.recent.RecentsHorizontalScrollView>
-
- </FrameLayout>
-
- <include layout="@layout/status_bar_no_recent_apps"
- android:id="@+id/recents_no_apps"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:visibility="invisible" />
-
-</com.android.systemui.recent.RecentsPanelView>
diff --git a/packages/SystemUI/res/layout/notification_public_default.xml b/packages/SystemUI/res/layout/notification_public_default.xml
index acfc4bb..efabc06 100644
--- a/packages/SystemUI/res/layout/notification_public_default.xml
+++ b/packages/SystemUI/res/layout/notification_public_default.xml
@@ -37,7 +37,7 @@
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_alignParentEnd="true"
- android:layout_alignBaseline="@id/title"
+ android:layout_alignBaseline="@+id/title"
android:singleLine="true"
android:gravity="center"
android:paddingStart="8dp"
diff --git a/packages/SystemUI/res/layout/status_bar_recent_item.xml b/packages/SystemUI/res/layout/status_bar_recent_item.xml
deleted file mode 100644
index 6290bb3..0000000
--- a/packages/SystemUI/res/layout/status_bar_recent_item.xml
+++ /dev/null
@@ -1,109 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* apps/common/assets/default/default/skins/StatusBar.xml
-**
-** Copyright 2006, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:paddingTop="@dimen/status_bar_recents_item_padding"
- android:paddingBottom="@dimen/status_bar_recents_item_padding"
- android:clipChildren="false"
- android:importantForAccessibility="no">
-
- <RelativeLayout android:id="@+id/recent_item"
- android:layout_gravity="center_horizontal"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:clipChildren="false">
-
- <TextView android:id="@+id/app_label"
- android:layout_width="@dimen/status_bar_recents_app_label_width"
- android:layout_height="wrap_content"
- android:textSize="@dimen/status_bar_recents_app_label_text_size"
- android:fadingEdge="horizontal"
- android:fadingEdgeLength="@dimen/status_bar_recents_text_fading_edge_length"
- android:scrollHorizontally="true"
- android:layout_alignParentStart="true"
- android:layout_alignTop="@+id/app_icon"
- android:paddingTop="2dp"
- android:layout_marginStart="@dimen/status_bar_recents_app_label_left_margin"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textColor="@color/status_bar_recents_app_label_color"
- android:importantForAccessibility="no"
- android:textAlignment="viewStart"
- />
- <FrameLayout android:id="@+id/app_thumbnail"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_toEndOf="@id/app_label"
- android:layout_marginStart="@dimen/status_bar_recents_thumbnail_left_margin"
- android:background="@drawable/recents_thumbnail_bg"
- android:foreground="@drawable/recents_thumbnail_fg"
- android:visibility="invisible">
- <ImageView android:id="@+id/app_thumbnail_image"
- android:layout_width="@dimen/status_bar_recents_thumbnail_width"
- android:layout_height="@dimen/status_bar_recents_thumbnail_height"
- />
- </FrameLayout>
- <View android:id="@+id/recents_callout_line"
- android:layout_width="@dimen/status_bar_recents_app_label_width"
- android:layout_height="1dip"
- android:layout_alignParentStart="true"
- android:layout_marginStart="@dimen/status_bar_recents_app_label_left_margin"
- android:layout_toStartOf="@id/app_thumbnail"
- android:layout_below="@id/app_label"
- android:layout_marginEnd="3dip"
- android:layout_marginTop="3dip"
- android:background="@drawable/recents_callout_line"
- />
-
- <ImageView android:id="@id/app_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_toEndOf="@id/app_label"
- android:layout_marginStart="@dimen/status_bar_recents_app_icon_left_margin"
- android:layout_marginTop="@dimen/status_bar_recents_app_icon_top_margin"
- android:maxWidth="@dimen/status_bar_recents_app_icon_max_width"
- android:maxHeight="@dimen/status_bar_recents_app_icon_max_height"
- android:scaleType="centerInside"
- android:adjustViewBounds="true"
- android:visibility="invisible"
- />
-
- <TextView android:id="@+id/app_description"
- android:layout_width="@dimen/status_bar_recents_app_label_width"
- android:layout_height="wrap_content"
- android:textSize="@dimen/status_bar_recents_app_description_text_size"
- android:fadingEdge="horizontal"
- android:fadingEdgeLength="@dimen/status_bar_recents_text_fading_edge_length"
- android:scrollHorizontally="true"
- android:layout_alignParentStart="true"
- android:layout_marginStart="@dimen/status_bar_recents_app_label_left_margin"
- android:layout_below="@id/recents_callout_line"
- android:layout_marginTop="3dip"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAlignment="viewStart"
- />
-
- </RelativeLayout>
-</FrameLayout>
diff --git a/packages/SystemUI/res/layout/status_bar_recent_panel.xml b/packages/SystemUI/res/layout/status_bar_recent_panel.xml
deleted file mode 100644
index 588873a..0000000
--- a/packages/SystemUI/res/layout/status_bar_recent_panel.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* apps/common/assets/default/default/skins/StatusBar.xml
-**
-** Copyright 2010, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<com.android.systemui.recent.RecentsPanelView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res-auto"
- android:id="@+id/recents_root"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:foreground="@drawable/bg_protect"
- systemui:recentItemLayout="@layout/status_bar_recent_item"
- >
- <FrameLayout
- android:id="@+id/recents_bg_protect"
- android:background="@drawable/status_bar_recents_background"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_alignParentBottom="true">
-
- <com.android.systemui.recent.RecentsVerticalScrollView
- android:id="@+id/recents_container"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginEnd="0dp"
- android:divider="@null"
- android:stackFromBottom="true"
- android:fadingEdge="vertical"
- android:scrollbars="none"
- android:fadingEdgeLength="@dimen/status_bar_recents_scroll_fading_edge_length"
- android:layout_gravity="bottom|start"
- android:clipToPadding="false"
- android:clipChildren="false">
-
- <LinearLayout android:id="@+id/recents_linear_layout"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:fitsSystemWindows="true"
- android:clipToPadding="false"
- android:clipChildren="false">
- </LinearLayout>
-
- </com.android.systemui.recent.RecentsVerticalScrollView>
-
- </FrameLayout>
-
- <include layout="@layout/status_bar_no_recent_apps"
- android:id="@+id/recents_no_apps"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:visibility="invisible" />
-
-</com.android.systemui.recent.RecentsPanelView>
diff --git a/packages/SystemUI/res/menu/recent_popup_menu.xml b/packages/SystemUI/res/menu/recent_popup_menu.xml
deleted file mode 100644
index eecfb9a..0000000
--- a/packages/SystemUI/res/menu/recent_popup_menu.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* apps/common/assets/default/default/skins/StatusBar.xml
-**
-** Copyright 2011, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@+id/recent_remove_item" android:title="@string/status_bar_recent_remove_item_title" />
- <item android:id="@+id/recent_inspect_item" android:title="@string/status_bar_recent_inspect_item_title" />
-</menu>
diff --git a/packages/SystemUI/res/values-af/strings.xml b/packages/SystemUI/res/values-af/strings.xml
index d32539b..fd8d8e1 100644
--- a/packages/SystemUI/res/values-af/strings.xml
+++ b/packages/SystemUI/res/values-af/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Klaar"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Gekoppel"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Gekoppel via Wi-Fi-assistent"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Gestoor"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Koppel tans …"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"USB-verbinding"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Warmkol"</string>
diff --git a/packages/SystemUI/res/values-am/strings.xml b/packages/SystemUI/res/values-am/strings.xml
index 5bc7d59..3cc57f4 100644
--- a/packages/SystemUI/res/values-am/strings.xml
+++ b/packages/SystemUI/res/values-am/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"ተከናውኗል"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"ተገናኝቷል"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"በWi‑Fi ረዳት አማካኝነት ተገናኝቷል"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"ተቀምጧል"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"በማገናኘት ላይ..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"በማገናኘት ላይ"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"መገናኛ ነጥብ"</string>
diff --git a/packages/SystemUI/res/values-ar/strings.xml b/packages/SystemUI/res/values-ar/strings.xml
index 8a23713..9ba068a 100644
--- a/packages/SystemUI/res/values-ar/strings.xml
+++ b/packages/SystemUI/res/values-ar/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"تم"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"متصل"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"تم التوصيل عبر مساعد Wi-Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"تم الحفظ"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"جارٍ الاتصال..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"النطاق"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"نقطة اتصال"</string>
diff --git a/packages/SystemUI/res/values-bg/strings.xml b/packages/SystemUI/res/values-bg/strings.xml
index 120a49b..fc01954 100644
--- a/packages/SystemUI/res/values-bg/strings.xml
+++ b/packages/SystemUI/res/values-bg/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Готово"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Установена е връзка"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Установена е връзка чрез помощника за Wi-Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Запазено"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Установява се връзка..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Тетъринг"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Точка за достъп"</string>
diff --git a/packages/SystemUI/res/values-bn-rBD/strings.xml b/packages/SystemUI/res/values-bn-rBD/strings.xml
index cfc6b3e..c138bb2 100644
--- a/packages/SystemUI/res/values-bn-rBD/strings.xml
+++ b/packages/SystemUI/res/values-bn-rBD/strings.xml
@@ -262,6 +262,8 @@
<string name="quick_settings_done" msgid="3402999958839153376">"সম্পন্ন হয়েছে"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"সংযুক্ত হয়েছে"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Wi‑Fi সহায়ক-এর মাধ্যমে সংযুক্ত হয়েছে"</string>
+ <!-- no translation found for quick_settings_saved (4758747300943481411) -->
+ <skip />
<string name="quick_settings_connecting" msgid="47623027419264404">"সংযুক্ত হচ্ছে..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"টেদারিং"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"হটস্পট"</string>
diff --git a/packages/SystemUI/res/values-ca/strings.xml b/packages/SystemUI/res/values-ca/strings.xml
index 0236dfe..12c07d5 100644
--- a/packages/SystemUI/res/values-ca/strings.xml
+++ b/packages/SystemUI/res/values-ca/strings.xml
@@ -264,6 +264,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Fet"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Connectat"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Connectat mitjançant l\'assistent de Wi‑Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"S\'ha desat"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"S\'està connectant..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Ancoratge a xarxa"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Zona Wi-Fi"</string>
diff --git a/packages/SystemUI/res/values-cs/strings.xml b/packages/SystemUI/res/values-cs/strings.xml
index 791ae1b..643fee7 100644
--- a/packages/SystemUI/res/values-cs/strings.xml
+++ b/packages/SystemUI/res/values-cs/strings.xml
@@ -264,6 +264,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Hotovo"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Připojeno"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Připojeno pomocí asistenta připojení Wi-Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Uloženo"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Připojování..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Sdílení datového připojení"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Hotspot"</string>
diff --git a/packages/SystemUI/res/values-da/strings.xml b/packages/SystemUI/res/values-da/strings.xml
index 5be774e..e92cbf0 100644
--- a/packages/SystemUI/res/values-da/strings.xml
+++ b/packages/SystemUI/res/values-da/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Udført"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Tilsluttet"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Forbindelse via Wi-Fi-assistent"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Gemt"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Opretter forbindelse…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Netdeling"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Hotspot"</string>
diff --git a/packages/SystemUI/res/values-de/strings.xml b/packages/SystemUI/res/values-de/strings.xml
index 4bc932b..b4f4f20 100644
--- a/packages/SystemUI/res/values-de/strings.xml
+++ b/packages/SystemUI/res/values-de/strings.xml
@@ -264,6 +264,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Fertig"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Verbunden"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Über WLAN-Assistenten verbunden"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Gespeichert"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Verbindung wird hergestellt…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Tethering"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Hotspot"</string>
diff --git a/packages/SystemUI/res/values-el/strings.xml b/packages/SystemUI/res/values-el/strings.xml
index e131037..3e4c79ea 100644
--- a/packages/SystemUI/res/values-el/strings.xml
+++ b/packages/SystemUI/res/values-el/strings.xml
@@ -264,6 +264,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Τέλος"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Συνδέθηκε"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Σύνδεση μέσω βοηθού Wi‑Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Αποθηκεύτηκε"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Σύνδεση…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Πρόσδεση"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Σημείο πρόσβασης Wi-Fi"</string>
diff --git a/packages/SystemUI/res/values-en-rGB/strings.xml b/packages/SystemUI/res/values-en-rGB/strings.xml
index f61724d..e79ef4e 100644
--- a/packages/SystemUI/res/values-en-rGB/strings.xml
+++ b/packages/SystemUI/res/values-en-rGB/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Done"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Connected"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Connected via Wi‑Fi assistant"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Saved"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Connecting..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Tethering"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Hotspot"</string>
diff --git a/packages/SystemUI/res/values-en-rIN/strings.xml b/packages/SystemUI/res/values-en-rIN/strings.xml
index f61724d..e79ef4e 100644
--- a/packages/SystemUI/res/values-en-rIN/strings.xml
+++ b/packages/SystemUI/res/values-en-rIN/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Done"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Connected"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Connected via Wi‑Fi assistant"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Saved"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Connecting..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Tethering"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Hotspot"</string>
diff --git a/packages/SystemUI/res/values-es-rUS/strings.xml b/packages/SystemUI/res/values-es-rUS/strings.xml
index c70c8e8..6c2f35b 100644
--- a/packages/SystemUI/res/values-es-rUS/strings.xml
+++ b/packages/SystemUI/res/values-es-rUS/strings.xml
@@ -264,6 +264,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Listo"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Conectado"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Conexión por asistente de Wi-Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Guardado/a"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Conectando…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Anclaje a red"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Zona"</string>
diff --git a/packages/SystemUI/res/values-es/strings.xml b/packages/SystemUI/res/values-es/strings.xml
index 4a05367..b3ee1e9 100644
--- a/packages/SystemUI/res/values-es/strings.xml
+++ b/packages/SystemUI/res/values-es/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Listo"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Conectado"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Conectado a través de asistente Wi‑Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Guardado"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Conectando..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Anclaje a red"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Zona Wi-Fi"</string>
diff --git a/packages/SystemUI/res/values-et-rEE/strings.xml b/packages/SystemUI/res/values-et-rEE/strings.xml
index fc5b18c..003e4cc 100644
--- a/packages/SystemUI/res/values-et-rEE/strings.xml
+++ b/packages/SystemUI/res/values-et-rEE/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Valmis"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Ühendatud"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Ühendatud WiFi-abi kaudu"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Salvestatud"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Ühenduse loomine ..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Jagamine"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Leviala"</string>
diff --git a/packages/SystemUI/res/values-eu-rES/strings.xml b/packages/SystemUI/res/values-eu-rES/strings.xml
index d284b47..67c1348 100644
--- a/packages/SystemUI/res/values-eu-rES/strings.xml
+++ b/packages/SystemUI/res/values-eu-rES/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Eginda"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Konektatuta"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Wi‑Fi laguntzailearen bidez konektatuta"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Gordeta"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Konektatzen…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Konexioa partekatzea"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Sare publikoa"</string>
diff --git a/packages/SystemUI/res/values-fa/strings.xml b/packages/SystemUI/res/values-fa/strings.xml
index 37aab03..96ecb4e0 100644
--- a/packages/SystemUI/res/values-fa/strings.xml
+++ b/packages/SystemUI/res/values-fa/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"انجام شد"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"متصل"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"متصل شده از طریق دستیار Wi-Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"ذخیره شده"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"در حال اتصال..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"اتصال به اینترنت با تلفن همراه"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"نقطه اتصال"</string>
diff --git a/packages/SystemUI/res/values-fi/strings.xml b/packages/SystemUI/res/values-fi/strings.xml
index fb8b0d78..dff31a0 100644
--- a/packages/SystemUI/res/values-fi/strings.xml
+++ b/packages/SystemUI/res/values-fi/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Valmis"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Yhdistetty"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Yhteys muodostettu Wi‑Fi-apurin kautta"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Tallennetut"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Yhdistetään…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Jaettu yhteys"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Hotspot"</string>
diff --git a/packages/SystemUI/res/values-fr-rCA/strings.xml b/packages/SystemUI/res/values-fr-rCA/strings.xml
index 10b6a2d..f1f986b 100644
--- a/packages/SystemUI/res/values-fr-rCA/strings.xml
+++ b/packages/SystemUI/res/values-fr-rCA/strings.xml
@@ -264,6 +264,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Terminé"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Connecté"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Connecté à l\'aide de l\'assistant Wi-Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Enregistré"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Connexion en cours…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Partage de connexion"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Point d\'accès sans fil"</string>
diff --git a/packages/SystemUI/res/values-fr/strings.xml b/packages/SystemUI/res/values-fr/strings.xml
index 05ca6dc..bd5eb50 100644
--- a/packages/SystemUI/res/values-fr/strings.xml
+++ b/packages/SystemUI/res/values-fr/strings.xml
@@ -264,6 +264,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"OK"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Connecté"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Connecté via l\'assistant Wi‑Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Enregistré"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Connexion en cours..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Partage de connexion"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Point d\'accès"</string>
diff --git a/packages/SystemUI/res/values-gl-rES/strings.xml b/packages/SystemUI/res/values-gl-rES/strings.xml
index f97e226..839a4d2 100644
--- a/packages/SystemUI/res/values-gl-rES/strings.xml
+++ b/packages/SystemUI/res/values-gl-rES/strings.xml
@@ -264,6 +264,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Feito"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Conectado"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Conectado ao asistente de wifi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Gardado"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Conectando..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Ancoraxe á rede"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Zona wifi"</string>
diff --git a/packages/SystemUI/res/values-hi/strings.xml b/packages/SystemUI/res/values-hi/strings.xml
index 924fece..810f52e 100644
--- a/packages/SystemUI/res/values-hi/strings.xml
+++ b/packages/SystemUI/res/values-hi/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"पूर्ण"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"कनेक्ट है"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"वाई-फ़ाई सहायक के द्वारा कनेक्ट है"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"सहेजा गया"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"कनेक्ट हो रहा है..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"टेदरिंग"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"हॉटस्पॉट"</string>
diff --git a/packages/SystemUI/res/values-hr/strings.xml b/packages/SystemUI/res/values-hr/strings.xml
index 38723c4..4cc49b6 100644
--- a/packages/SystemUI/res/values-hr/strings.xml
+++ b/packages/SystemUI/res/values-hr/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Gotovo"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Povezano"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Povezani putem pomoćnika za Wi-Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Spremljeno"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Povezivanje..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Dijeljenje veze"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Žarišna točka"</string>
diff --git a/packages/SystemUI/res/values-hu/strings.xml b/packages/SystemUI/res/values-hu/strings.xml
index b4e0601..714f5f6 100644
--- a/packages/SystemUI/res/values-hu/strings.xml
+++ b/packages/SystemUI/res/values-hu/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Kész"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Csatlakoztatva"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Csatlakozva Wi‑Fi-segéddel"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Mentett"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Csatlakozás…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Megosztás"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Hotspot"</string>
diff --git a/packages/SystemUI/res/values-hy-rAM/strings.xml b/packages/SystemUI/res/values-hy-rAM/strings.xml
index ea00568..a13e88f 100644
--- a/packages/SystemUI/res/values-hy-rAM/strings.xml
+++ b/packages/SystemUI/res/values-hy-rAM/strings.xml
@@ -262,6 +262,8 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Պատրաստ է"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Կապակցված է"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Կապակցված է Wi‑Fi Օգնականի միջոցով"</string>
+ <!-- no translation found for quick_settings_saved (4758747300943481411) -->
+ <skip />
<string name="quick_settings_connecting" msgid="47623027419264404">"Միանում է..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Միացում"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Թեժ կետ"</string>
diff --git a/packages/SystemUI/res/values-in/strings.xml b/packages/SystemUI/res/values-in/strings.xml
index 1674c3f..eb595ed 100644
--- a/packages/SystemUI/res/values-in/strings.xml
+++ b/packages/SystemUI/res/values-in/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Selesai"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Tersambung"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Terhubung melalui Asisten Wi-Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Disimpan"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Menyambung..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Menambatkan"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Hotspot"</string>
diff --git a/packages/SystemUI/res/values-is-rIS/strings.xml b/packages/SystemUI/res/values-is-rIS/strings.xml
index 9ba0b54..25ee045 100644
--- a/packages/SystemUI/res/values-is-rIS/strings.xml
+++ b/packages/SystemUI/res/values-is-rIS/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Lokið"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Tengt"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Tengt í gegnum Wi-Fi aðstoð"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Vistað"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Tengist..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Tjóðrun"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Heitur reitur"</string>
diff --git a/packages/SystemUI/res/values-it/strings.xml b/packages/SystemUI/res/values-it/strings.xml
index 052678a..ceaab6d 100644
--- a/packages/SystemUI/res/values-it/strings.xml
+++ b/packages/SystemUI/res/values-it/strings.xml
@@ -264,6 +264,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Fine"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Connesso"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Connesso tramite assistente Wi‑Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Salvata"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Connessione..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Tethering"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Hotspot"</string>
diff --git a/packages/SystemUI/res/values-iw/strings.xml b/packages/SystemUI/res/values-iw/strings.xml
index 5fa4e31..0eb8076 100644
--- a/packages/SystemUI/res/values-iw/strings.xml
+++ b/packages/SystemUI/res/values-iw/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"בוצע"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"מחובר"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"מחובר באמצעות אסיסטנט ה-Wi-Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"נשמר"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"מתחבר..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"שיתוף אינטרנט בין ניידים"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"נקודה לשיתוף אינטרנט"</string>
diff --git a/packages/SystemUI/res/values-ja/strings.xml b/packages/SystemUI/res/values-ja/strings.xml
index d581e73..47a0303 100644
--- a/packages/SystemUI/res/values-ja/strings.xml
+++ b/packages/SystemUI/res/values-ja/strings.xml
@@ -264,6 +264,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"完了"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"接続済み"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Wi‑Fiアシスタント経由で接続"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"保存済み"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"接続しています..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"テザリング"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"アクセスポイント"</string>
diff --git a/packages/SystemUI/res/values-ka-rGE/strings.xml b/packages/SystemUI/res/values-ka-rGE/strings.xml
index e5f8f36..6a2223a 100644
--- a/packages/SystemUI/res/values-ka-rGE/strings.xml
+++ b/packages/SystemUI/res/values-ka-rGE/strings.xml
@@ -262,6 +262,8 @@
<string name="quick_settings_done" msgid="3402999958839153376">"დასრულდა"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"დაკავშირებულია"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"დაკავშირებული Wi-Fi თანაშემწით"</string>
+ <!-- no translation found for quick_settings_saved (4758747300943481411) -->
+ <skip />
<string name="quick_settings_connecting" msgid="47623027419264404">"დაკავშირება..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"მოდემის რეჟიმი"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"წვდომის წერტილი"</string>
diff --git a/packages/SystemUI/res/values-kk-rKZ/strings.xml b/packages/SystemUI/res/values-kk-rKZ/strings.xml
index 838d94d..ca9379e 100644
--- a/packages/SystemUI/res/values-kk-rKZ/strings.xml
+++ b/packages/SystemUI/res/values-kk-rKZ/strings.xml
@@ -262,6 +262,8 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Дайын"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Қосылды"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Wi‑Fi көмекшісі арқылы қосылу орындалды"</string>
+ <!-- no translation found for quick_settings_saved (4758747300943481411) -->
+ <skip />
<string name="quick_settings_connecting" msgid="47623027419264404">"Қосылуда…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Тетеринг"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Хот-спот"</string>
diff --git a/packages/SystemUI/res/values-km-rKH/strings.xml b/packages/SystemUI/res/values-km-rKH/strings.xml
index 7f47ff2..c429cd0 100644
--- a/packages/SystemUI/res/values-km-rKH/strings.xml
+++ b/packages/SystemUI/res/values-km-rKH/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"រួចរាល់"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"បានភ្ជាប់"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"បានភ្ជាប់តាមរយៈជំនួយការ Wi‑Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"បានរក្សាទុក"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"កំពុងតភ្ជាប់..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"ការភ្ជាប់"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"ហតស្ប៉ត"</string>
diff --git a/packages/SystemUI/res/values-kn-rIN/strings.xml b/packages/SystemUI/res/values-kn-rIN/strings.xml
index 181706f..1048077 100644
--- a/packages/SystemUI/res/values-kn-rIN/strings.xml
+++ b/packages/SystemUI/res/values-kn-rIN/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"ಮುಗಿದಿದೆ"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"ಸಂಪರ್ಕಗೊಂಡಿದೆ"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Wi‑Fi ಸಹಾಯಕದ ಮೂಲಕ ಸಂಪರ್ಕಿತಗೊಳಿಸಲಾಗಿದೆ"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"ಉಳಿಸಲಾಗಿದೆ"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"ಸಂಪರ್ಕಿಸಲಾಗುತ್ತಿದೆ..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"ಟೆಥರಿಂಗ್"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"ಹಾಟ್ಸ್ಪಾಟ್"</string>
diff --git a/packages/SystemUI/res/values-ko/strings.xml b/packages/SystemUI/res/values-ko/strings.xml
index 054c192..4c2d19c 100644
--- a/packages/SystemUI/res/values-ko/strings.xml
+++ b/packages/SystemUI/res/values-ko/strings.xml
@@ -262,6 +262,8 @@
<string name="quick_settings_done" msgid="3402999958839153376">"완료"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"연결됨"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Wi‑Fi 도우미를 통해 연결됨"</string>
+ <!-- no translation found for quick_settings_saved (4758747300943481411) -->
+ <skip />
<string name="quick_settings_connecting" msgid="47623027419264404">"연결 중..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"테더링"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"핫스팟"</string>
diff --git a/packages/SystemUI/res/values-ky-rKG/strings.xml b/packages/SystemUI/res/values-ky-rKG/strings.xml
index fed9f25..c9a2674 100644
--- a/packages/SystemUI/res/values-ky-rKG/strings.xml
+++ b/packages/SystemUI/res/values-ky-rKG/strings.xml
@@ -287,6 +287,8 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Аткарылды"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Туташкан"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Wi‑Fi жардамчысы аркылуу туташып турат"</string>
+ <!-- no translation found for quick_settings_saved (4758747300943481411) -->
+ <skip />
<string name="quick_settings_connecting" msgid="47623027419264404">"Туташууда…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Тетеринг"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Туташуу чекити"</string>
diff --git a/packages/SystemUI/res/values-lo-rLA/strings.xml b/packages/SystemUI/res/values-lo-rLA/strings.xml
index 9808830..89ca89b 100644
--- a/packages/SystemUI/res/values-lo-rLA/strings.xml
+++ b/packages/SystemUI/res/values-lo-rLA/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"ແລ້ວໆ"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"ເຊື່ອມຕໍ່ແລ້ວ"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"ເຊື່ອມຕໍ່ຜ່ານ Wi‑Fi ຕົວຊ່ວຍແລ້ວ"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"ບັນທຶກແລ້ວ"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"ກຳລັງເຊື່ອມຕໍ່..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"ການປ່ອນສັນຍານ"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"ຮັອດສະປອດ"</string>
diff --git a/packages/SystemUI/res/values-lt/strings.xml b/packages/SystemUI/res/values-lt/strings.xml
index a8dd63c..8f3e0d9 100644
--- a/packages/SystemUI/res/values-lt/strings.xml
+++ b/packages/SystemUI/res/values-lt/strings.xml
@@ -262,6 +262,8 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Atlikta"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Prijungtas"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Prisijungta naudojant „Wi‑Fi“ pagelbiklį"</string>
+ <!-- no translation found for quick_settings_saved (4758747300943481411) -->
+ <skip />
<string name="quick_settings_connecting" msgid="47623027419264404">"Prisijungiama..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Susiejimas"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Viešosios interneto prieigos taškas"</string>
diff --git a/packages/SystemUI/res/values-lv/strings.xml b/packages/SystemUI/res/values-lv/strings.xml
index 5fc3b0b..00ca8a9 100644
--- a/packages/SystemUI/res/values-lv/strings.xml
+++ b/packages/SystemUI/res/values-lv/strings.xml
@@ -262,6 +262,8 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Gatavs"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Pievienota"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Izveidots savienojums ar Wi‑Fi palīgu"</string>
+ <!-- no translation found for quick_settings_saved (4758747300943481411) -->
+ <skip />
<string name="quick_settings_connecting" msgid="47623027419264404">"Notiek savienojuma izveide…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Piesaiste"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Tīklājs"</string>
diff --git a/packages/SystemUI/res/values-mk-rMK/strings.xml b/packages/SystemUI/res/values-mk-rMK/strings.xml
index 1a0f59e..3a86e69 100644
--- a/packages/SystemUI/res/values-mk-rMK/strings.xml
+++ b/packages/SystemUI/res/values-mk-rMK/strings.xml
@@ -264,6 +264,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Готово"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Поврзано"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Поврзано преку помошник за Wi-Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Зачувано"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Се поврзува..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Поврзување"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Точка на пристап"</string>
diff --git a/packages/SystemUI/res/values-ml-rIN/strings.xml b/packages/SystemUI/res/values-ml-rIN/strings.xml
index 357af5d..820b3f2b 100644
--- a/packages/SystemUI/res/values-ml-rIN/strings.xml
+++ b/packages/SystemUI/res/values-ml-rIN/strings.xml
@@ -262,6 +262,8 @@
<string name="quick_settings_done" msgid="3402999958839153376">"പൂർത്തിയാക്കി"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"കണക്റ്റുചെയ്തു"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Wi‑Fi അസിസ്റ്റന്റ് മുഖേന കണക്റ്റുചെയ്തു"</string>
+ <!-- no translation found for quick_settings_saved (4758747300943481411) -->
+ <skip />
<string name="quick_settings_connecting" msgid="47623027419264404">"കണക്റ്റുചെയ്യുന്നു..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"ടെതറിംഗ്"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"ഹോട്ട്സ്പോട്ട്"</string>
diff --git a/packages/SystemUI/res/values-mn-rMN/strings.xml b/packages/SystemUI/res/values-mn-rMN/strings.xml
index b215ac7..942c612 100644
--- a/packages/SystemUI/res/values-mn-rMN/strings.xml
+++ b/packages/SystemUI/res/values-mn-rMN/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Дууссан"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Холбогдсон"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Wi-Fi туслагчаар дамжуулан холбогдлоо"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Хадгалагдсан"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Холбогдож байна..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Модем болгох"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Сүлжээний цэг"</string>
diff --git a/packages/SystemUI/res/values-mr-rIN/strings.xml b/packages/SystemUI/res/values-mr-rIN/strings.xml
index e7ecaa4..bacfe00 100644
--- a/packages/SystemUI/res/values-mr-rIN/strings.xml
+++ b/packages/SystemUI/res/values-mr-rIN/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"पूर्ण झाले"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"कनेक्ट केलेले"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Wi‑Fi सहाय्यक द्वारे कनेक्ट केले"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"जतन केलेले"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"कनेक्ट करीत आहे..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"टेदरिंग"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"हॉटस्पॉट"</string>
diff --git a/packages/SystemUI/res/values-ms-rMY/strings.xml b/packages/SystemUI/res/values-ms-rMY/strings.xml
index 67c23d6..fe89626 100644
--- a/packages/SystemUI/res/values-ms-rMY/strings.xml
+++ b/packages/SystemUI/res/values-ms-rMY/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Selesai"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Disambungkan"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Disambungkan melalui Pembantu Wi-Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Disimpan"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Menyambung..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Penambatan"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Tempat liputan"</string>
diff --git a/packages/SystemUI/res/values-my-rMM/strings.xml b/packages/SystemUI/res/values-my-rMM/strings.xml
index f3830dd..1fbabcb 100644
--- a/packages/SystemUI/res/values-my-rMM/strings.xml
+++ b/packages/SystemUI/res/values-my-rMM/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"လုပ်ပြီး"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"ချိတ်ဆက်ထား"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"ကြိုးမဲ့ကူညီသူမှတဆင့် ချိတ်ဆက်ပြီး၏"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"သိမ်းဆည်းပြီး"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"ဆက်သွယ်နေ..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"တွဲချီပေးခြင်း"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"ဟော့စပေါ့"</string>
diff --git a/packages/SystemUI/res/values-nb/strings.xml b/packages/SystemUI/res/values-nb/strings.xml
index a99b3d0..52795b0 100644
--- a/packages/SystemUI/res/values-nb/strings.xml
+++ b/packages/SystemUI/res/values-nb/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Ferdig"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Tilkoblet"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Koblet til via en Wi-Fi-assistent"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Lagret"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Kobler til …"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Tilknytning"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Wi-Fi-sone"</string>
diff --git a/packages/SystemUI/res/values-ne-rNP/strings.xml b/packages/SystemUI/res/values-ne-rNP/strings.xml
index e30f49f..217fb82 100644
--- a/packages/SystemUI/res/values-ne-rNP/strings.xml
+++ b/packages/SystemUI/res/values-ne-rNP/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"भयो"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"जोडिएको"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Wi-Fi सहायक द्वारा जोडिएको"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"सुरक्षित गरियो"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"जडान हुँदै..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"टेदर गर्दै"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"हटस्पट"</string>
diff --git a/packages/SystemUI/res/values-nl/strings.xml b/packages/SystemUI/res/values-nl/strings.xml
index 060b1c5..f2b03e9 100644
--- a/packages/SystemUI/res/values-nl/strings.xml
+++ b/packages/SystemUI/res/values-nl/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Gereed"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Verbonden"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Verbonden via wifi-assistent"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Opgeslagen"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Verbinding maken…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Tethering"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Hotspot"</string>
diff --git a/packages/SystemUI/res/values-pl/strings.xml b/packages/SystemUI/res/values-pl/strings.xml
index a68d076..d9a59b5 100644
--- a/packages/SystemUI/res/values-pl/strings.xml
+++ b/packages/SystemUI/res/values-pl/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Gotowe"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Połączono"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Połączono przez Asystenta Wi‑Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Zapisano"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Łączę..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Powiązanie"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Punkt dostępu"</string>
diff --git a/packages/SystemUI/res/values-pt-rPT/strings.xml b/packages/SystemUI/res/values-pt-rPT/strings.xml
index db1528e..19be904 100644
--- a/packages/SystemUI/res/values-pt-rPT/strings.xml
+++ b/packages/SystemUI/res/values-pt-rPT/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Concluído"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Ligado"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Ligado através do Assistente de Wi‑Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Guardado(a)"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"A ligar..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Associação"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Zona Wi-Fi"</string>
diff --git a/packages/SystemUI/res/values-pt/strings.xml b/packages/SystemUI/res/values-pt/strings.xml
index 87eb2db..2f17f1b 100644
--- a/packages/SystemUI/res/values-pt/strings.xml
+++ b/packages/SystemUI/res/values-pt/strings.xml
@@ -264,6 +264,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Concluído"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Conectado"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Conectado via assistente de Wi‑Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Salvo"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Conectando..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Tethering"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Ponto de acesso"</string>
diff --git a/packages/SystemUI/res/values-ro/strings.xml b/packages/SystemUI/res/values-ro/strings.xml
index 76a33c5..4a6611bf 100644
--- a/packages/SystemUI/res/values-ro/strings.xml
+++ b/packages/SystemUI/res/values-ro/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Terminat"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Conectat"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Conexiune realizată printr-un asistent Wi-Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Salvat"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Se conectează..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Tethering"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Hotspot"</string>
diff --git a/packages/SystemUI/res/values-ru/strings.xml b/packages/SystemUI/res/values-ru/strings.xml
index 28451b1..0913c4a 100644
--- a/packages/SystemUI/res/values-ru/strings.xml
+++ b/packages/SystemUI/res/values-ru/strings.xml
@@ -264,6 +264,8 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Готово"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Подключено"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Установлено подключение через Ассистента Wi-Fi"</string>
+ <!-- no translation found for quick_settings_saved (4758747300943481411) -->
+ <skip />
<string name="quick_settings_connecting" msgid="47623027419264404">"Соединение..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Режим модема"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Точка доступа"</string>
diff --git a/packages/SystemUI/res/values-si-rLK/strings.xml b/packages/SystemUI/res/values-si-rLK/strings.xml
index 0256a66..44a15d0 100644
--- a/packages/SystemUI/res/values-si-rLK/strings.xml
+++ b/packages/SystemUI/res/values-si-rLK/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"නිමයි"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"සම්බන්ධිත"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Wi‑Fi සහායක හරහා සම්බන්ධ කරන ලදි"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"සුරකින ලදි"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"සම්බන්ධ වෙමින්..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"ටෙදරින්"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"හොට්ස්පොට්"</string>
diff --git a/packages/SystemUI/res/values-sk/strings.xml b/packages/SystemUI/res/values-sk/strings.xml
index 0a27b91..c7dd7de 100644
--- a/packages/SystemUI/res/values-sk/strings.xml
+++ b/packages/SystemUI/res/values-sk/strings.xml
@@ -264,6 +264,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Hotovo"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Pripojené"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Pripojené pomocou Asistenta Wi-Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Uložené"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Pripája sa..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Zdieľanie dátového pripojenia"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Hotspot"</string>
diff --git a/packages/SystemUI/res/values-sl/strings.xml b/packages/SystemUI/res/values-sl/strings.xml
index 4bd5ddd..60264fc 100644
--- a/packages/SystemUI/res/values-sl/strings.xml
+++ b/packages/SystemUI/res/values-sl/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Končano"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Povezava je vzpostavljena"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Povezava vzpostavljena prek pomočnika za Wi-Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Shranjeno"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Vzpostavljanje povezave ..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Internet prek mobilne naprave"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Dostopna točka"</string>
diff --git a/packages/SystemUI/res/values-sr/strings.xml b/packages/SystemUI/res/values-sr/strings.xml
index 8a15b9f..7858484 100644
--- a/packages/SystemUI/res/values-sr/strings.xml
+++ b/packages/SystemUI/res/values-sr/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Готово"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Повезан"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Повезано преко Wi‑Fi помоћника"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Сачувано"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Повезује се..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Повезивање"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Хотспот"</string>
diff --git a/packages/SystemUI/res/values-sv/strings.xml b/packages/SystemUI/res/values-sv/strings.xml
index ea2c07a..0f6a227 100644
--- a/packages/SystemUI/res/values-sv/strings.xml
+++ b/packages/SystemUI/res/values-sv/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Klart"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Ansluten"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Ansluten via Wi-Fi-assistent"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Sparad"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Ansluter ..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Internetdelning"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Trådlös surfzon"</string>
diff --git a/packages/SystemUI/res/values-sw/strings.xml b/packages/SystemUI/res/values-sw/strings.xml
index 6b4d4af..d89b926 100644
--- a/packages/SystemUI/res/values-sw/strings.xml
+++ b/packages/SystemUI/res/values-sw/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Nimemaliza"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Imeunganishwa"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Imeunganishwa kupitia Kisaidizi cha Wi-Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Kilichohifadhiwa"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Inaunganisha..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Kusambaza mtandao"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Mtandao-hewa"</string>
diff --git a/packages/SystemUI/res/values-ta-rIN/strings.xml b/packages/SystemUI/res/values-ta-rIN/strings.xml
index 27c2c6d..6fa1c09 100644
--- a/packages/SystemUI/res/values-ta-rIN/strings.xml
+++ b/packages/SystemUI/res/values-ta-rIN/strings.xml
@@ -262,6 +262,8 @@
<string name="quick_settings_done" msgid="3402999958839153376">"முடிந்தது"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"இணைக்கப்பட்டது"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"வைஃபை அசிஸ்டண்ட் மூலம் இணைக்கப்பட்டது"</string>
+ <!-- no translation found for quick_settings_saved (4758747300943481411) -->
+ <skip />
<string name="quick_settings_connecting" msgid="47623027419264404">"இணைக்கிறது..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"டெதெரிங்"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"ஹாட்ஸ்பாட்"</string>
diff --git a/packages/SystemUI/res/values-te-rIN/strings.xml b/packages/SystemUI/res/values-te-rIN/strings.xml
index bc7edb2..b48fbd1 100644
--- a/packages/SystemUI/res/values-te-rIN/strings.xml
+++ b/packages/SystemUI/res/values-te-rIN/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"పూర్తయింది"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"కనెక్ట్ చేయబడినది"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Wi‑Fi సహాయకం ద్వారా కనెక్ట్ చేయబడింది"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"సేవ్ చేయబడింది"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"కనెక్ట్ అవుతోంది..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"టీథరింగ్"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"హాట్స్పాట్"</string>
diff --git a/packages/SystemUI/res/values-th/strings.xml b/packages/SystemUI/res/values-th/strings.xml
index c5e0e6a..b7fd59f 100644
--- a/packages/SystemUI/res/values-th/strings.xml
+++ b/packages/SystemUI/res/values-th/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"เสร็จสิ้น"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"เชื่อมต่อ"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"เชื่อมต่อผ่านตัวช่วย Wi-Fi อยู่"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"ที่บันทึกไว้"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"กำลังเชื่อมต่อ..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"การปล่อยสัญญาณ"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"ฮอตสปอต"</string>
diff --git a/packages/SystemUI/res/values-tl/strings.xml b/packages/SystemUI/res/values-tl/strings.xml
index b870c7a..0528467 100644
--- a/packages/SystemUI/res/values-tl/strings.xml
+++ b/packages/SystemUI/res/values-tl/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Tapos na"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Nakakonekta"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Nakakonekta sa pamamagitan ng Wi‑Fi assistant"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Na-save"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Kumokonekta..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Nagte-tether"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Hotspot"</string>
diff --git a/packages/SystemUI/res/values-tr/strings.xml b/packages/SystemUI/res/values-tr/strings.xml
index 03ddc46..50463a4 100644
--- a/packages/SystemUI/res/values-tr/strings.xml
+++ b/packages/SystemUI/res/values-tr/strings.xml
@@ -262,6 +262,8 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Bitti"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Bağlı"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Kablosuz bağlantı yardımcısıyla bağlandı"</string>
+ <!-- no translation found for quick_settings_saved (4758747300943481411) -->
+ <skip />
<string name="quick_settings_connecting" msgid="47623027419264404">"Bağlanılıyor..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Tethering"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Hotspot"</string>
diff --git a/packages/SystemUI/res/values-uk/strings.xml b/packages/SystemUI/res/values-uk/strings.xml
index 133954e..4a93528 100644
--- a/packages/SystemUI/res/values-uk/strings.xml
+++ b/packages/SystemUI/res/values-uk/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Готово"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Під’єднано"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Під’єднано через Диспетчер Wi-Fi-з’єднання"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Збережено"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"З’єднання…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Режим модема"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Точка доступу"</string>
diff --git a/packages/SystemUI/res/values-ur-rPK/strings.xml b/packages/SystemUI/res/values-ur-rPK/strings.xml
index f34a685..febd144 100644
--- a/packages/SystemUI/res/values-ur-rPK/strings.xml
+++ b/packages/SystemUI/res/values-ur-rPK/strings.xml
@@ -262,6 +262,8 @@
<string name="quick_settings_done" msgid="3402999958839153376">"ہو گیا"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"مربوط"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Wi‑Fi اسسٹنٹ کے ذریعے منسلک ہے"</string>
+ <!-- no translation found for quick_settings_saved (4758747300943481411) -->
+ <skip />
<string name="quick_settings_connecting" msgid="47623027419264404">"مربوط ہو رہا ہے…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"مربوط کرنا"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"ہاٹ اسپاٹ"</string>
diff --git a/packages/SystemUI/res/values-uz-rUZ/strings.xml b/packages/SystemUI/res/values-uz-rUZ/strings.xml
index 8b8fedc..62b7091 100644
--- a/packages/SystemUI/res/values-uz-rUZ/strings.xml
+++ b/packages/SystemUI/res/values-uz-rUZ/strings.xml
@@ -262,6 +262,8 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Tayyor"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Ulangan"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Wi‑Fi yordamchisi orqali ulangan"</string>
+ <!-- no translation found for quick_settings_saved (4758747300943481411) -->
+ <skip />
<string name="quick_settings_connecting" msgid="47623027419264404">"Ulanmoqda…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Modem rejimi"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Ulanish nuqtasi"</string>
diff --git a/packages/SystemUI/res/values-vi/strings.xml b/packages/SystemUI/res/values-vi/strings.xml
index f92116d..0276b98 100644
--- a/packages/SystemUI/res/values-vi/strings.xml
+++ b/packages/SystemUI/res/values-vi/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Xong"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Đã kết nối"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Được kết nối qua trình hỗ trợ Wi‑Fi"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Đã lưu"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Đang kết nối..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Đang dùng làm điểm truy cập Internet"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"Điểm phát sóng"</string>
diff --git a/packages/SystemUI/res/values-zh-rCN/strings.xml b/packages/SystemUI/res/values-zh-rCN/strings.xml
index c3811f8..04b7ed9 100644
--- a/packages/SystemUI/res/values-zh-rCN/strings.xml
+++ b/packages/SystemUI/res/values-zh-rCN/strings.xml
@@ -264,6 +264,8 @@
<string name="quick_settings_done" msgid="3402999958839153376">"完成"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"已连接"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"已连接(通过 WLAN 助手)"</string>
+ <!-- no translation found for quick_settings_saved (4758747300943481411) -->
+ <skip />
<string name="quick_settings_connecting" msgid="47623027419264404">"正在连接…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"网络共享"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"热点"</string>
diff --git a/packages/SystemUI/res/values-zh-rHK/strings.xml b/packages/SystemUI/res/values-zh-rHK/strings.xml
index 7532520..5e871cf 100644
--- a/packages/SystemUI/res/values-zh-rHK/strings.xml
+++ b/packages/SystemUI/res/values-zh-rHK/strings.xml
@@ -264,6 +264,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"完成"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"已連線"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"已透過 Wi-Fi 小幫手連線"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"已儲存"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"正在連線…"</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"網絡共享"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"熱點"</string>
diff --git a/packages/SystemUI/res/values-zh-rTW/strings.xml b/packages/SystemUI/res/values-zh-rTW/strings.xml
index 082a92e4..9cc70d0 100644
--- a/packages/SystemUI/res/values-zh-rTW/strings.xml
+++ b/packages/SystemUI/res/values-zh-rTW/strings.xml
@@ -264,6 +264,8 @@
<string name="quick_settings_done" msgid="3402999958839153376">"完成"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"已連線"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"已透過 Wi‑Fi 小幫手連線"</string>
+ <!-- no translation found for quick_settings_saved (4758747300943481411) -->
+ <skip />
<string name="quick_settings_connecting" msgid="47623027419264404">"連線中..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"網路共用"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"無線基地台"</string>
diff --git a/packages/SystemUI/res/values-zu/strings.xml b/packages/SystemUI/res/values-zu/strings.xml
index b3572a2..4c6aa33 100644
--- a/packages/SystemUI/res/values-zu/strings.xml
+++ b/packages/SystemUI/res/values-zu/strings.xml
@@ -262,6 +262,7 @@
<string name="quick_settings_done" msgid="3402999958839153376">"Kwenziwe"</string>
<string name="quick_settings_connected" msgid="1722253542984847487">"Ixhunyiwe"</string>
<string name="quick_settings_connected_via_wfa" msgid="1587051627194895715">"Ixhunywe ngomsizi we-Wi-FI"</string>
+ <string name="quick_settings_saved" msgid="4758747300943481411">"Ilondoloziwe"</string>
<string name="quick_settings_connecting" msgid="47623027419264404">"Iyaxhuma..."</string>
<string name="quick_settings_tethering_label" msgid="7153452060448575549">"Ukusebenzisa njengemodemu"</string>
<string name="quick_settings_hotspot_label" msgid="6046917934974004879">"I-Hotspot"</string>
diff --git a/packages/SystemUI/res/values/ids.xml b/packages/SystemUI/res/values/ids.xml
index 4a9eb55..033a90e 100644
--- a/packages/SystemUI/res/values/ids.xml
+++ b/packages/SystemUI/res/values/ids.xml
@@ -36,5 +36,6 @@
<item type="id" name="height_animator_start_value_tag"/>
<item type="id" name="doze_saved_filter_tag"/>
<item type="id" name="qs_icon_tag"/>
+ <item type="id" name="scrim"/>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
index b3f90d7..e302c98 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
@@ -41,7 +41,7 @@
*/
private final Class<?>[] SERVICES = new Class[] {
com.android.systemui.keyguard.KeyguardViewMediator.class,
- com.android.systemui.recent.Recents.class,
+ com.android.systemui.recents.Recents.class,
com.android.systemui.volume.VolumeUI.class,
com.android.systemui.statusbar.SystemBars.class,
com.android.systemui.usb.StorageNotification.class,
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index e66934e..f9e0219 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -63,7 +63,6 @@
import com.android.keyguard.KeyguardDisplayManager;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
-import com.android.keyguard.MultiUserAvatarCache;
import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.SystemUI;
import com.android.systemui.statusbar.phone.PhoneStatusBar;
@@ -335,12 +334,10 @@
@Override
public void onUserRemoved(int userId) {
mLockPatternUtils.removeUser(userId);
- MultiUserAvatarCache.getInstance().clear(userId);
}
@Override
public void onUserInfoChanged(int userId) {
- MultiUserAvatarCache.getInstance().clear(userId);
}
@Override
@@ -477,11 +474,6 @@
}
@Override
- public void onUserActivityTimeoutChanged() {
- mStatusBarKeyguardViewManager.updateUserActivityTimeout();
- }
-
- @Override
public void keyguardDonePending() {
mKeyguardDonePending = true;
mHideAnimationRun = true;
diff --git a/packages/SystemUI/src/com/android/systemui/recent/ColorDrawableWithDimensions.java b/packages/SystemUI/src/com/android/systemui/recent/ColorDrawableWithDimensions.java
deleted file mode 100644
index b4d3edd..0000000
--- a/packages/SystemUI/src/com/android/systemui/recent/ColorDrawableWithDimensions.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.recent;
-
-import android.graphics.drawable.ColorDrawable;
-
-public class ColorDrawableWithDimensions extends ColorDrawable {
- private int mWidth;
- private int mHeight;
-
- public ColorDrawableWithDimensions(int color, int width, int height) {
- super(color);
- mWidth = width;
- mHeight = height;
- }
-
- @Override
- public int getIntrinsicWidth() {
- return mWidth;
- }
-
- @Override
- public int getIntrinsicHeight() {
- return mHeight;
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/Constants.java b/packages/SystemUI/src/com/android/systemui/recent/Constants.java
deleted file mode 100644
index 8252a9f8..0000000
--- a/packages/SystemUI/src/com/android/systemui/recent/Constants.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.recent;
-
-public class Constants {
- static final int MAX_ESCAPE_ANIMATION_DURATION = 500; // in ms
- static final int SNAP_BACK_DURATION = 250; // in ms
- static final int ESCAPE_VELOCITY = 100; // speed of item required to "curate" it in dp/s
- public static float ALPHA_FADE_START = 0.8f; // fraction of thumbnail width where fade starts
- static final float ALPHA_FADE_END = 0.5f; // fraction of thumbnail width beyond which alpha->0
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/FadedEdgeDrawHelper.java b/packages/SystemUI/src/com/android/systemui/recent/FadedEdgeDrawHelper.java
deleted file mode 100644
index 59f7a80..0000000
--- a/packages/SystemUI/src/com/android/systemui/recent/FadedEdgeDrawHelper.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.recent;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.LinearGradient;
-import android.graphics.Matrix;
-import android.graphics.Paint;
-import android.graphics.Shader;
-import android.util.AttributeSet;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.widget.LinearLayout;
-
-import com.android.systemui.R;
-
-public class FadedEdgeDrawHelper {
- public static final boolean OPTIMIZE_SW_RENDERED_RECENTS = true;
- public static final boolean USE_DARK_FADE_IN_HW_ACCELERATED_MODE = true;
- private View mScrollView;
-
- private int mFadingEdgeLength;
- private boolean mIsVertical;
- private boolean mSoftwareRendered = false;
- private Paint mBlackPaint;
- private Paint mFadePaint;
- private Matrix mFadeMatrix;
- private LinearGradient mFade;
-
- public static FadedEdgeDrawHelper create(Context context,
- AttributeSet attrs, View scrollView, boolean isVertical) {
- boolean isTablet = context.getResources().
- getBoolean(R.bool.config_recents_interface_for_tablets);
- if (!isTablet && (OPTIMIZE_SW_RENDERED_RECENTS || USE_DARK_FADE_IN_HW_ACCELERATED_MODE)) {
- return new FadedEdgeDrawHelper(context, attrs, scrollView, isVertical);
- } else {
- return null;
- }
- }
-
- public FadedEdgeDrawHelper(Context context,
- AttributeSet attrs, View scrollView, boolean isVertical) {
- mScrollView = scrollView;
- TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.View);
- mFadingEdgeLength = a.getDimensionPixelSize(android.R.styleable.View_fadingEdgeLength,
- ViewConfiguration.get(context).getScaledFadingEdgeLength());
- mIsVertical = isVertical;
- }
-
- public void onAttachedToWindowCallback(
- LinearLayout layout, boolean hardwareAccelerated) {
- mSoftwareRendered = !hardwareAccelerated;
- if ((mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS)
- || USE_DARK_FADE_IN_HW_ACCELERATED_MODE) {
- mScrollView.setVerticalFadingEdgeEnabled(false);
- mScrollView.setHorizontalFadingEdgeEnabled(false);
- }
- }
-
- public void addViewCallback(View newLinearLayoutChild) {
- if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) {
- final RecentsPanelView.ViewHolder holder =
- (RecentsPanelView.ViewHolder) newLinearLayoutChild.getTag();
- holder.labelView.setDrawingCacheEnabled(true);
- holder.labelView.buildDrawingCache();
- }
- }
-
- public void drawCallback(Canvas canvas,
- int left, int right, int top, int bottom, int scrollX, int scrollY,
- float topFadingEdgeStrength, float bottomFadingEdgeStrength,
- float leftFadingEdgeStrength, float rightFadingEdgeStrength, int mPaddingTop) {
-
- if ((mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS)
- || USE_DARK_FADE_IN_HW_ACCELERATED_MODE) {
- if (mFadePaint == null) {
- mFadePaint = new Paint();
- mFadeMatrix = new Matrix();
- // use use a height of 1, and then wack the matrix each time we
- // actually use it.
- mFade = new LinearGradient(0, 0, 0, 1, 0xCC000000, 0, Shader.TileMode.CLAMP);
- // PULL OUT THIS CONSTANT
- mFadePaint.setShader(mFade);
- }
-
- // draw the fade effect
- boolean drawTop = false;
- boolean drawBottom = false;
- boolean drawLeft = false;
- boolean drawRight = false;
-
- float topFadeStrength = 0.0f;
- float bottomFadeStrength = 0.0f;
- float leftFadeStrength = 0.0f;
- float rightFadeStrength = 0.0f;
-
- final float fadeHeight = mFadingEdgeLength;
- int length = (int) fadeHeight;
-
- // clip the fade length if top and bottom fades overlap
- // overlapping fades produce odd-looking artifacts
- if (mIsVertical && (top + length > bottom - length)) {
- length = (bottom - top) / 2;
- }
-
- // also clip horizontal fades if necessary
- if (!mIsVertical && (left + length > right - length)) {
- length = (right - left) / 2;
- }
-
- if (mIsVertical) {
- topFadeStrength = Math.max(0.0f, Math.min(1.0f, topFadingEdgeStrength));
- drawTop = topFadeStrength * fadeHeight > 1.0f;
- bottomFadeStrength = Math.max(0.0f, Math.min(1.0f, bottomFadingEdgeStrength));
- drawBottom = bottomFadeStrength * fadeHeight > 1.0f;
- }
-
- if (!mIsVertical) {
- leftFadeStrength = Math.max(0.0f, Math.min(1.0f, leftFadingEdgeStrength));
- drawLeft = leftFadeStrength * fadeHeight > 1.0f;
- rightFadeStrength = Math.max(0.0f, Math.min(1.0f, rightFadingEdgeStrength));
- drawRight = rightFadeStrength * fadeHeight > 1.0f;
- }
-
- if (drawTop) {
- mFadeMatrix.setScale(1, fadeHeight * topFadeStrength);
- mFadeMatrix.postTranslate(left, top);
- mFade.setLocalMatrix(mFadeMatrix);
- mFadePaint.setShader(mFade);
- canvas.drawRect(left, top, right, top + length, mFadePaint);
-
- if (mBlackPaint == null) {
- // Draw under the status bar at the top
- mBlackPaint = new Paint();
- mBlackPaint.setColor(0xFF000000);
- }
- canvas.drawRect(left, top - mPaddingTop, right, top, mBlackPaint);
- }
-
- if (drawBottom) {
- mFadeMatrix.setScale(1, fadeHeight * bottomFadeStrength);
- mFadeMatrix.postRotate(180);
- mFadeMatrix.postTranslate(left, bottom);
- mFade.setLocalMatrix(mFadeMatrix);
- mFadePaint.setShader(mFade);
- canvas.drawRect(left, bottom - length, right, bottom, mFadePaint);
- }
-
- if (drawLeft) {
- mFadeMatrix.setScale(1, fadeHeight * leftFadeStrength);
- mFadeMatrix.postRotate(-90);
- mFadeMatrix.postTranslate(left, top);
- mFade.setLocalMatrix(mFadeMatrix);
- mFadePaint.setShader(mFade);
- canvas.drawRect(left, top, left + length, bottom, mFadePaint);
- }
-
- if (drawRight) {
- mFadeMatrix.setScale(1, fadeHeight * rightFadeStrength);
- mFadeMatrix.postRotate(90);
- mFadeMatrix.postTranslate(right, top);
- mFade.setLocalMatrix(mFadeMatrix);
- mFadePaint.setShader(mFade);
- canvas.drawRect(right - length, top, right, bottom, mFadePaint);
- }
- }
- }
-
- public int getVerticalFadingEdgeLength() {
- return mFadingEdgeLength;
- }
-
- public int getHorizontalFadingEdgeLength() {
- return mFadingEdgeLength;
- }
-
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/FirstFrameAnimatorHelper.java b/packages/SystemUI/src/com/android/systemui/recent/FirstFrameAnimatorHelper.java
deleted file mode 100644
index 84d13cf..0000000
--- a/packages/SystemUI/src/com/android/systemui/recent/FirstFrameAnimatorHelper.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.recent;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ValueAnimator;
-import android.util.Log;
-import android.view.View;
-import android.view.ViewPropertyAnimator;
-import android.view.ViewTreeObserver;
-
-/*
- * This is a helper class that listens to updates from the corresponding animation.
- * For the first two frames, it adjusts the current play time of the animation to
- * prevent jank at the beginning of the animation
- */
-public class FirstFrameAnimatorHelper extends AnimatorListenerAdapter
- implements ValueAnimator.AnimatorUpdateListener {
- private static final boolean DEBUG = false;
- private static final int MAX_DELAY = 1000;
- private static final int IDEAL_FRAME_DURATION = 16;
- private View mTarget;
- private long mStartFrame;
- private long mStartTime = -1;
- private boolean mHandlingOnAnimationUpdate;
- private boolean mAdjustedSecondFrameTime;
-
- private static ViewTreeObserver.OnDrawListener sGlobalDrawListener;
- private static long sGlobalFrameCounter;
-
- public FirstFrameAnimatorHelper(ValueAnimator animator, View target) {
- mTarget = target;
- animator.addUpdateListener(this);
- }
-
- public FirstFrameAnimatorHelper(ViewPropertyAnimator vpa, View target) {
- mTarget = target;
- vpa.setListener(this);
- }
-
- // only used for ViewPropertyAnimators
- public void onAnimationStart(Animator animation) {
- final ValueAnimator va = (ValueAnimator) animation;
- va.addUpdateListener(FirstFrameAnimatorHelper.this);
- onAnimationUpdate(va);
- }
-
- public static void initializeDrawListener(View view) {
- if (sGlobalDrawListener != null) {
- view.getViewTreeObserver().removeOnDrawListener(sGlobalDrawListener);
- }
- sGlobalDrawListener = new ViewTreeObserver.OnDrawListener() {
- private long mTime = System.currentTimeMillis();
- public void onDraw() {
- sGlobalFrameCounter++;
- if (DEBUG) {
- long newTime = System.currentTimeMillis();
- Log.d("FirstFrameAnimatorHelper", "TICK " + (newTime - mTime));
- mTime = newTime;
- }
- }
- };
- view.getViewTreeObserver().addOnDrawListener(sGlobalDrawListener);
- }
-
- public void onAnimationUpdate(final ValueAnimator animation) {
- final long currentTime = System.currentTimeMillis();
- if (mStartTime == -1) {
- mStartFrame = sGlobalFrameCounter;
- mStartTime = currentTime;
- }
-
- if (!mHandlingOnAnimationUpdate &&
- // If the current play time exceeds the duration, the animation
- // will get finished, even if we call setCurrentPlayTime -- therefore
- // don't adjust the animation in that case
- animation.getCurrentPlayTime() < animation.getDuration()) {
- mHandlingOnAnimationUpdate = true;
- long frameNum = sGlobalFrameCounter - mStartFrame;
- // If we haven't drawn our first frame, reset the time to t = 0
- // (give up after MAX_DELAY ms of waiting though - might happen, for example, if we
- // are no longer in the foreground and no frames are being rendered ever)
- if (frameNum == 0 && currentTime < mStartTime + MAX_DELAY) {
- // The first frame on animations doesn't always trigger an invalidate...
- // force an invalidate here to make sure the animation continues to advance
- mTarget.getRootView().invalidate();
- animation.setCurrentPlayTime(0);
-
- // For the second frame, if the first frame took more than 16ms,
- // adjust the start time and pretend it took only 16ms anyway. This
- // prevents a large jump in the animation due to an expensive first frame
- } else if (frameNum == 1 && currentTime < mStartTime + MAX_DELAY &&
- !mAdjustedSecondFrameTime &&
- currentTime > mStartTime + IDEAL_FRAME_DURATION) {
- animation.setCurrentPlayTime(IDEAL_FRAME_DURATION);
- mAdjustedSecondFrameTime = true;
- } else {
- if (frameNum > 1) {
- mTarget.post(new Runnable() {
- public void run() {
- animation.removeUpdateListener(FirstFrameAnimatorHelper.this);
- }
- });
- }
- if (DEBUG) print(animation);
- }
- mHandlingOnAnimationUpdate = false;
- } else {
- if (DEBUG) print(animation);
- }
- }
-
- public void print(ValueAnimator animation) {
- float flatFraction = animation.getCurrentPlayTime() / (float) animation.getDuration();
- Log.d("FirstFrameAnimatorHelper", sGlobalFrameCounter +
- "(" + (sGlobalFrameCounter - mStartFrame) + ") " + mTarget + " dirty? " +
- mTarget.isDirty() + " " + flatFraction + " " + this + " " + animation);
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
deleted file mode 100644
index 34430d9..0000000
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
+++ /dev/null
@@ -1,586 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.recent;
-
-import android.app.ActivityManager;
-import android.app.AppGlobals;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.ActivityInfo;
-import android.content.pm.IPackageManager;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.os.AsyncTask;
-import android.os.Handler;
-import android.os.Process;
-import android.os.RemoteException;
-import android.os.UserHandle;
-import android.util.Log;
-import android.view.MotionEvent;
-import android.view.View;
-
-import com.android.systemui.R;
-import com.android.systemui.recents.misc.SystemServicesProxy;
-import com.android.systemui.statusbar.phone.PhoneStatusBar;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-public class RecentTasksLoader implements View.OnTouchListener {
- static final String TAG = "RecentTasksLoader";
- static final boolean DEBUG = PhoneStatusBar.DEBUG || false;
-
- private static final int DISPLAY_TASKS = 20;
- private static final int MAX_TASKS = DISPLAY_TASKS + 1; // allow extra for non-apps
-
- private Context mContext;
- private RecentsPanelView mRecentsPanel;
-
- private Object mFirstTaskLock = new Object();
- private TaskDescription mFirstTask;
- private boolean mFirstTaskLoaded;
-
- private AsyncTask<Void, ArrayList<TaskDescription>, Void> mTaskLoader;
- private AsyncTask<Void, TaskDescription, Void> mThumbnailLoader;
- private Handler mHandler;
-
- private int mIconDpi;
- private ColorDrawableWithDimensions mDefaultThumbnailBackground;
- private ColorDrawableWithDimensions mDefaultIconBackground;
- private int mNumTasksInFirstScreenful = Integer.MAX_VALUE;
-
- private boolean mFirstScreenful;
- private ArrayList<TaskDescription> mLoadedTasks;
-
- private enum State { LOADING, LOADED, CANCELLED };
- private State mState = State.CANCELLED;
-
-
- private static RecentTasksLoader sInstance;
- public static RecentTasksLoader getInstance(Context context) {
- if (sInstance == null) {
- sInstance = new RecentTasksLoader(context);
- }
- return sInstance;
- }
-
- private RecentTasksLoader(Context context) {
- mContext = context;
- mHandler = new Handler();
-
- final Resources res = context.getResources();
-
- // get the icon size we want -- on tablets, we use bigger icons
- boolean isTablet = res.getBoolean(R.bool.config_recents_interface_for_tablets);
- if (isTablet) {
- ActivityManager activityManager =
- (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
- mIconDpi = activityManager.getLauncherLargeIconDensity();
- } else {
- mIconDpi = res.getDisplayMetrics().densityDpi;
- }
-
- // Render default icon (just a blank image)
- int defaultIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.app_icon_size);
- int iconSize = (int) (defaultIconSize * mIconDpi / res.getDisplayMetrics().densityDpi);
- mDefaultIconBackground = new ColorDrawableWithDimensions(0x00000000, iconSize, iconSize);
-
- // Render the default thumbnail background
- int thumbnailWidth =
- (int) res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_width);
- int thumbnailHeight =
- (int) res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_height);
- int color = res.getColor(R.drawable.status_bar_recents_app_thumbnail_background);
-
- mDefaultThumbnailBackground =
- new ColorDrawableWithDimensions(color, thumbnailWidth, thumbnailHeight);
- }
-
- public void setRecentsPanel(RecentsPanelView newRecentsPanel, RecentsPanelView caller) {
- // Only allow clearing mRecentsPanel if the caller is the current recentsPanel
- if (newRecentsPanel != null || mRecentsPanel == caller) {
- mRecentsPanel = newRecentsPanel;
- if (mRecentsPanel != null) {
- mNumTasksInFirstScreenful = mRecentsPanel.numItemsInOneScreenful();
- }
- }
- }
-
- public Drawable getDefaultThumbnail() {
- return mDefaultThumbnailBackground;
- }
-
- public Drawable getDefaultIcon() {
- return mDefaultIconBackground;
- }
-
- public ArrayList<TaskDescription> getLoadedTasks() {
- return mLoadedTasks;
- }
-
- public void remove(TaskDescription td) {
- mLoadedTasks.remove(td);
- }
-
- public boolean isFirstScreenful() {
- return mFirstScreenful;
- }
-
- private boolean isCurrentHomeActivity(ComponentName component, ActivityInfo homeInfo) {
- if (homeInfo == null) {
- final PackageManager pm = mContext.getPackageManager();
- homeInfo = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME)
- .resolveActivityInfo(pm, 0);
- }
- return homeInfo != null
- && homeInfo.packageName.equals(component.getPackageName())
- && homeInfo.name.equals(component.getClassName());
- }
-
- // Create an TaskDescription, returning null if the title or icon is null
- TaskDescription createTaskDescription(int taskId, int persistentTaskId, Intent baseIntent,
- ComponentName origActivity, CharSequence description, int userId) {
- Intent intent = new Intent(baseIntent);
- if (origActivity != null) {
- intent.setComponent(origActivity);
- }
- final PackageManager pm = mContext.getPackageManager();
- final IPackageManager ipm = AppGlobals.getPackageManager();
- intent.setFlags((intent.getFlags()&~Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED)
- | Intent.FLAG_ACTIVITY_NEW_TASK);
- ResolveInfo resolveInfo = null;
- try {
- resolveInfo = ipm.resolveIntent(intent, null, 0, userId);
- } catch (RemoteException re) {
- }
- if (resolveInfo != null) {
- final ActivityInfo info = resolveInfo.activityInfo;
- final String title = info.loadLabel(pm).toString();
-
- if (title != null && title.length() > 0) {
- if (DEBUG) Log.v(TAG, "creating activity desc for id="
- + persistentTaskId + ", label=" + title);
-
- TaskDescription item = new TaskDescription(taskId,
- persistentTaskId, resolveInfo, baseIntent, info.packageName,
- description, userId);
- item.setLabel(title);
-
- return item;
- } else {
- if (DEBUG) Log.v(TAG, "SKIPPING item " + persistentTaskId);
- }
- }
- return null;
- }
-
- void loadThumbnailAndIcon(TaskDescription td) {
- final ActivityManager am = (ActivityManager)
- mContext.getSystemService(Context.ACTIVITY_SERVICE);
- final PackageManager pm = mContext.getPackageManager();
- final Bitmap thumbnail = SystemServicesProxy.getThumbnail(am, td.persistentTaskId);
- Drawable icon = getFullResIcon(td.resolveInfo, pm);
- if (td.userId != UserHandle.myUserId()) {
- // Need to badge the icon
- icon = mContext.getPackageManager().getUserBadgedIcon(icon, new UserHandle(td.userId));
- }
- if (DEBUG) Log.v(TAG, "Loaded bitmap for task "
- + td + ": " + thumbnail);
- synchronized (td) {
- if (thumbnail != null) {
- td.setThumbnail(new BitmapDrawable(mContext.getResources(), thumbnail));
- } else {
- td.setThumbnail(mDefaultThumbnailBackground);
- }
- if (icon != null) {
- td.setIcon(icon);
- }
- td.setLoaded(true);
- }
- }
-
- Drawable getFullResDefaultActivityIcon() {
- return getFullResIcon(Resources.getSystem(),
- com.android.internal.R.mipmap.sym_def_app_icon);
- }
-
- Drawable getFullResIcon(Resources resources, int iconId) {
- try {
- return resources.getDrawableForDensity(iconId, mIconDpi);
- } catch (Resources.NotFoundException e) {
- return getFullResDefaultActivityIcon();
- }
- }
-
- private Drawable getFullResIcon(ResolveInfo info, PackageManager packageManager) {
- Resources resources;
- try {
- resources = packageManager.getResourcesForApplication(
- info.activityInfo.applicationInfo);
- } catch (PackageManager.NameNotFoundException e) {
- resources = null;
- }
- if (resources != null) {
- int iconId = info.activityInfo.getIconResource();
- if (iconId != 0) {
- return getFullResIcon(resources, iconId);
- }
- }
- return getFullResDefaultActivityIcon();
- }
-
- Runnable mPreloadTasksRunnable = new Runnable() {
- public void run() {
- loadTasksInBackground();
- }
- };
-
- // additional optimization when we have software system buttons - start loading the recent
- // tasks on touch down
- @Override
- public boolean onTouch(View v, MotionEvent ev) {
- int action = ev.getAction() & MotionEvent.ACTION_MASK;
- if (action == MotionEvent.ACTION_DOWN) {
- preloadRecentTasksList();
- } else if (action == MotionEvent.ACTION_CANCEL) {
- cancelPreloadingRecentTasksList();
- } else if (action == MotionEvent.ACTION_UP) {
- // Remove the preloader if we haven't called it yet
- mHandler.removeCallbacks(mPreloadTasksRunnable);
- if (!v.isPressed()) {
- cancelLoadingThumbnailsAndIcons();
- }
-
- }
- return false;
- }
-
- public void preloadRecentTasksList() {
- mHandler.post(mPreloadTasksRunnable);
- }
-
- public void cancelPreloadingRecentTasksList() {
- cancelLoadingThumbnailsAndIcons();
- mHandler.removeCallbacks(mPreloadTasksRunnable);
- }
-
- public void cancelLoadingThumbnailsAndIcons(RecentsPanelView caller) {
- // Only oblige this request if it comes from the current RecentsPanel
- // (eg when you rotate, the old RecentsPanel request should be ignored)
- if (mRecentsPanel == caller) {
- cancelLoadingThumbnailsAndIcons();
- }
- }
-
-
- private void cancelLoadingThumbnailsAndIcons() {
- if (mRecentsPanel != null && mRecentsPanel.isShowing()) {
- return;
- }
-
- if (mTaskLoader != null) {
- mTaskLoader.cancel(false);
- mTaskLoader = null;
- }
- if (mThumbnailLoader != null) {
- mThumbnailLoader.cancel(false);
- mThumbnailLoader = null;
- }
- mLoadedTasks = null;
- if (mRecentsPanel != null) {
- mRecentsPanel.onTaskLoadingCancelled();
- }
- mFirstScreenful = false;
- mState = State.CANCELLED;
- }
-
- private void clearFirstTask() {
- synchronized (mFirstTaskLock) {
- mFirstTask = null;
- mFirstTaskLoaded = false;
- }
- }
-
- public void preloadFirstTask() {
- Thread bgLoad = new Thread() {
- public void run() {
- TaskDescription first = loadFirstTask();
- synchronized(mFirstTaskLock) {
- if (mCancelPreloadingFirstTask) {
- clearFirstTask();
- } else {
- mFirstTask = first;
- mFirstTaskLoaded = true;
- }
- mPreloadingFirstTask = false;
- }
- }
- };
- synchronized(mFirstTaskLock) {
- if (!mPreloadingFirstTask) {
- clearFirstTask();
- mPreloadingFirstTask = true;
- bgLoad.start();
- }
- }
- }
-
- public void cancelPreloadingFirstTask() {
- synchronized(mFirstTaskLock) {
- if (mPreloadingFirstTask) {
- mCancelPreloadingFirstTask = true;
- } else {
- clearFirstTask();
- }
- }
- }
-
- boolean mPreloadingFirstTask;
- boolean mCancelPreloadingFirstTask;
- public TaskDescription getFirstTask() {
- while(true) {
- synchronized(mFirstTaskLock) {
- if (mFirstTaskLoaded) {
- return mFirstTask;
- } else if (!mFirstTaskLoaded && !mPreloadingFirstTask) {
- mFirstTask = loadFirstTask();
- mFirstTaskLoaded = true;
- return mFirstTask;
- }
- }
- try {
- Thread.sleep(3);
- } catch (InterruptedException e) {
- }
- }
- }
-
- public TaskDescription loadFirstTask() {
- final ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
-
- final List<ActivityManager.RecentTaskInfo> recentTasks = am.getRecentTasksForUser(1,
- ActivityManager.RECENT_IGNORE_UNAVAILABLE | ActivityManager.RECENT_INCLUDE_PROFILES,
- UserHandle.CURRENT.getIdentifier());
- TaskDescription item = null;
- if (recentTasks.size() > 0) {
- ActivityManager.RecentTaskInfo recentInfo = recentTasks.get(0);
-
- Intent intent = new Intent(recentInfo.baseIntent);
- if (recentInfo.origActivity != null) {
- intent.setComponent(recentInfo.origActivity);
- }
-
- // Don't load the current home activity.
- if (isCurrentHomeActivity(intent.getComponent(), null)) {
- return null;
- }
-
- // Don't load ourselves
- if (intent.getComponent().getPackageName().equals(mContext.getPackageName())) {
- return null;
- }
-
- item = createTaskDescription(recentInfo.id,
- recentInfo.persistentId, recentInfo.baseIntent,
- recentInfo.origActivity, recentInfo.description,
- recentInfo.userId);
- if (item != null) {
- loadThumbnailAndIcon(item);
- }
- return item;
- }
- return null;
- }
-
- public void loadTasksInBackground() {
- loadTasksInBackground(false);
- }
- public void loadTasksInBackground(final boolean zeroeth) {
- if (mState != State.CANCELLED) {
- return;
- }
- mState = State.LOADING;
- mFirstScreenful = true;
-
- final LinkedBlockingQueue<TaskDescription> tasksWaitingForThumbnails =
- new LinkedBlockingQueue<TaskDescription>();
- mTaskLoader = new AsyncTask<Void, ArrayList<TaskDescription>, Void>() {
- @Override
- protected void onProgressUpdate(ArrayList<TaskDescription>... values) {
- if (!isCancelled()) {
- ArrayList<TaskDescription> newTasks = values[0];
- // do a callback to RecentsPanelView to let it know we have more values
- // how do we let it know we're all done? just always call back twice
- if (mRecentsPanel != null) {
- mRecentsPanel.onTasksLoaded(newTasks, mFirstScreenful);
- }
- if (mLoadedTasks == null) {
- mLoadedTasks = new ArrayList<TaskDescription>();
- }
- mLoadedTasks.addAll(newTasks);
- mFirstScreenful = false;
- }
- }
- @Override
- protected Void doInBackground(Void... params) {
- // We load in two stages: first, we update progress with just the first screenful
- // of items. Then, we update with the rest of the items
- final int origPri = Process.getThreadPriority(Process.myTid());
- Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
- final PackageManager pm = mContext.getPackageManager();
- final ActivityManager am = (ActivityManager)
- mContext.getSystemService(Context.ACTIVITY_SERVICE);
-
- final List<ActivityManager.RecentTaskInfo> recentTasks =
- am.getRecentTasks(MAX_TASKS, ActivityManager.RECENT_IGNORE_UNAVAILABLE
- | ActivityManager.RECENT_INCLUDE_PROFILES);
- int numTasks = recentTasks.size();
- ActivityInfo homeInfo = new Intent(Intent.ACTION_MAIN)
- .addCategory(Intent.CATEGORY_HOME).resolveActivityInfo(pm, 0);
-
- boolean firstScreenful = true;
- ArrayList<TaskDescription> tasks = new ArrayList<TaskDescription>();
-
- // skip the first task - assume it's either the home screen or the current activity.
- final int first = 0;
- for (int i = first, index = 0; i < numTasks && (index < MAX_TASKS); ++i) {
- if (isCancelled()) {
- break;
- }
- final ActivityManager.RecentTaskInfo recentInfo = recentTasks.get(i);
-
- Intent intent = new Intent(recentInfo.baseIntent);
- if (recentInfo.origActivity != null) {
- intent.setComponent(recentInfo.origActivity);
- }
-
- // Don't load the current home activity.
- if (isCurrentHomeActivity(intent.getComponent(), homeInfo)) {
- continue;
- }
-
- // Don't load ourselves
- if (intent.getComponent().getPackageName().equals(mContext.getPackageName())) {
- continue;
- }
-
- TaskDescription item = createTaskDescription(recentInfo.id,
- recentInfo.persistentId, recentInfo.baseIntent,
- recentInfo.origActivity, recentInfo.description,
- recentInfo.userId);
-
- if (item != null) {
- while (true) {
- try {
- tasksWaitingForThumbnails.put(item);
- break;
- } catch (InterruptedException e) {
- }
- }
- tasks.add(item);
- if (firstScreenful && tasks.size() == mNumTasksInFirstScreenful) {
- publishProgress(tasks);
- tasks = new ArrayList<TaskDescription>();
- firstScreenful = false;
- //break;
- }
- ++index;
- }
- }
-
- if (!isCancelled()) {
- publishProgress(tasks);
- if (firstScreenful) {
- // always should publish two updates
- publishProgress(new ArrayList<TaskDescription>());
- }
- }
-
- while (true) {
- try {
- tasksWaitingForThumbnails.put(new TaskDescription());
- break;
- } catch (InterruptedException e) {
- }
- }
-
- Process.setThreadPriority(origPri);
- return null;
- }
- };
- mTaskLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
- loadThumbnailsAndIconsInBackground(tasksWaitingForThumbnails);
- }
-
- private void loadThumbnailsAndIconsInBackground(
- final BlockingQueue<TaskDescription> tasksWaitingForThumbnails) {
- // continually read items from tasksWaitingForThumbnails and load
- // thumbnails and icons for them. finish thread when cancelled or there
- // is a null item in tasksWaitingForThumbnails
- mThumbnailLoader = new AsyncTask<Void, TaskDescription, Void>() {
- @Override
- protected void onProgressUpdate(TaskDescription... values) {
- if (!isCancelled()) {
- TaskDescription td = values[0];
- if (td.isNull()) { // end sentinel
- mState = State.LOADED;
- } else {
- if (mRecentsPanel != null) {
- mRecentsPanel.onTaskThumbnailLoaded(td);
- }
- }
- }
- }
- @Override
- protected Void doInBackground(Void... params) {
- final int origPri = Process.getThreadPriority(Process.myTid());
- Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
-
- while (true) {
- if (isCancelled()) {
- break;
- }
- TaskDescription td = null;
- while (td == null) {
- try {
- td = tasksWaitingForThumbnails.take();
- } catch (InterruptedException e) {
- }
- }
- if (td.isNull()) { // end sentinel
- publishProgress(td);
- break;
- }
- loadThumbnailAndIcon(td);
-
- publishProgress(td);
- }
-
- Process.setThreadPriority(origPri);
- return null;
- }
- };
- mThumbnailLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/Recents.java b/packages/SystemUI/src/com/android/systemui/recent/Recents.java
deleted file mode 100644
index e9f3cf9..0000000
--- a/packages/SystemUI/src/com/android/systemui/recent/Recents.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.recent;
-
-import android.app.ActivityOptions;
-import android.content.ActivityNotFoundException;
-import android.content.Context;
-import android.content.Intent;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.os.Bundle;
-import android.os.UserHandle;
-import android.util.DisplayMetrics;
-import android.util.Log;
-import android.view.Display;
-import android.view.View;
-import com.android.systemui.R;
-import com.android.systemui.RecentsComponent;
-import com.android.systemui.SystemUI;
-import com.android.systemui.recents.AlternateRecentsComponent;
-
-
-public class Recents extends SystemUI implements RecentsComponent {
- private static final String TAG = "Recents";
- private static final boolean DEBUG = true;
-
- // Which recents to use
- boolean mUseAlternateRecents = true;
- boolean mBootCompleted = false;
- static AlternateRecentsComponent sAlternateRecents;
-
- /** Returns the Recents component, creating a new one in-process if necessary. */
- public static AlternateRecentsComponent getRecentsComponent(Context context,
- boolean forceInitialize) {
- if (sAlternateRecents == null) {
- sAlternateRecents = new AlternateRecentsComponent(context);
- if (forceInitialize) {
- sAlternateRecents.onStart();
- sAlternateRecents.onBootCompleted();
- }
- }
- return sAlternateRecents;
- }
-
- @Override
- public void start() {
- if (mUseAlternateRecents) {
- if (sAlternateRecents == null) {
- sAlternateRecents = getRecentsComponent(mContext, false);
- }
- sAlternateRecents.onStart();
- }
-
- putComponent(RecentsComponent.class, this);
- }
-
- @Override
- protected void onBootCompleted() {
- if (mUseAlternateRecents) {
- if (sAlternateRecents != null) {
- sAlternateRecents.onBootCompleted();
- }
- }
- mBootCompleted = true;
- }
-
- @Override
- public void showRecents(boolean triggeredFromAltTab, View statusBarView) {
- if (mUseAlternateRecents) {
- sAlternateRecents.onShowRecents(triggeredFromAltTab);
- }
- }
-
- @Override
- public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
- if (mUseAlternateRecents) {
- sAlternateRecents.onHideRecents(triggeredFromAltTab, triggeredFromHomeKey);
- } else {
- Intent intent = new Intent(RecentsActivity.CLOSE_RECENTS_INTENT);
- intent.setPackage("com.android.systemui");
- sendBroadcastSafely(intent);
-
- RecentTasksLoader.getInstance(mContext).cancelPreloadingFirstTask();
- }
- }
-
- @Override
- public void toggleRecents(Display display, int layoutDirection, View statusBarView) {
- if (mUseAlternateRecents) {
- // Launch the alternate recents if required
- sAlternateRecents.onToggleRecents();
- return;
- }
-
- if (DEBUG) Log.d(TAG, "toggle recents panel");
- try {
- TaskDescription firstTask = RecentTasksLoader.getInstance(mContext).getFirstTask();
-
- Intent intent = new Intent(RecentsActivity.TOGGLE_RECENTS_INTENT);
- intent.setClassName("com.android.systemui",
- "com.android.systemui.recent.RecentsActivity");
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
-
- if (firstTask == null) {
- if (RecentsActivity.forceOpaqueBackground(mContext)) {
- ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext,
- R.anim.recents_launch_from_launcher_enter,
- R.anim.recents_launch_from_launcher_exit);
- mContext.startActivityAsUser(intent, opts.toBundle(), new UserHandle(
- UserHandle.USER_CURRENT));
- } else {
- // The correct window animation will be applied via the activity's style
- mContext.startActivityAsUser(intent, new UserHandle(
- UserHandle.USER_CURRENT));
- }
-
- } else {
- Bitmap first = null;
- if (firstTask.getThumbnail() instanceof BitmapDrawable) {
- first = ((BitmapDrawable) firstTask.getThumbnail()).getBitmap();
- } else {
- first = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
- Drawable d = RecentTasksLoader.getInstance(mContext).getDefaultThumbnail();
- d.draw(new Canvas(first));
- }
- final Resources res = mContext.getResources();
-
- float thumbWidth = res
- .getDimensionPixelSize(R.dimen.status_bar_recents_thumbnail_width);
- float thumbHeight = res
- .getDimensionPixelSize(R.dimen.status_bar_recents_thumbnail_height);
- if (first == null) {
- throw new RuntimeException("Recents thumbnail is null");
- }
- if (first.getWidth() != thumbWidth || first.getHeight() != thumbHeight) {
- first = Bitmap.createScaledBitmap(first, (int) thumbWidth, (int) thumbHeight,
- true);
- if (first == null) {
- throw new RuntimeException("Recents thumbnail is null");
- }
- }
-
-
- DisplayMetrics dm = new DisplayMetrics();
- display.getMetrics(dm);
- // calculate it here, but consider moving it elsewhere
- // first, determine which orientation you're in.
- final Configuration config = res.getConfiguration();
- int x, y;
-
- if (config.orientation == Configuration.ORIENTATION_PORTRAIT) {
- float appLabelLeftMargin = res.getDimensionPixelSize(
- R.dimen.status_bar_recents_app_label_left_margin);
- float appLabelWidth = res.getDimensionPixelSize(
- R.dimen.status_bar_recents_app_label_width);
- float thumbLeftMargin = res.getDimensionPixelSize(
- R.dimen.status_bar_recents_thumbnail_left_margin);
- float thumbBgPadding = res.getDimensionPixelSize(
- R.dimen.status_bar_recents_thumbnail_bg_padding);
-
- float width = appLabelLeftMargin +
- +appLabelWidth
- + thumbLeftMargin
- + thumbWidth
- + 2 * thumbBgPadding;
-
- x = (int) ((dm.widthPixels - width) / 2f + appLabelLeftMargin + appLabelWidth
- + thumbBgPadding + thumbLeftMargin);
- y = (int) (dm.heightPixels
- - res.getDimensionPixelSize(R.dimen.status_bar_recents_thumbnail_height)
- - thumbBgPadding);
- if (layoutDirection == View.LAYOUT_DIRECTION_RTL) {
- x = dm.widthPixels - x - res.getDimensionPixelSize(
- R.dimen.status_bar_recents_thumbnail_width);
- }
-
- } else { // if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
- float thumbTopMargin = res.getDimensionPixelSize(
- R.dimen.status_bar_recents_thumbnail_top_margin);
- float thumbBgPadding = res.getDimensionPixelSize(
- R.dimen.status_bar_recents_thumbnail_bg_padding);
- float textPadding = res.getDimensionPixelSize(
- R.dimen.status_bar_recents_text_description_padding);
- float labelTextSize = res.getDimensionPixelSize(
- R.dimen.status_bar_recents_app_label_text_size);
- Paint p = new Paint();
- p.setTextSize(labelTextSize);
- float labelTextHeight = p.getFontMetricsInt().bottom
- - p.getFontMetricsInt().top;
- float descriptionTextSize = res.getDimensionPixelSize(
- R.dimen.status_bar_recents_app_description_text_size);
- p.setTextSize(descriptionTextSize);
- float descriptionTextHeight = p.getFontMetricsInt().bottom
- - p.getFontMetricsInt().top;
-
- float statusBarHeight = res.getDimensionPixelSize(
- com.android.internal.R.dimen.status_bar_height);
- float recentsItemTopPadding = statusBarHeight;
-
- float height = thumbTopMargin
- + thumbHeight
- + 2 * thumbBgPadding + textPadding + labelTextHeight
- + recentsItemTopPadding + textPadding + descriptionTextHeight;
- float recentsItemRightPadding = res
- .getDimensionPixelSize(R.dimen.status_bar_recents_item_padding);
- float recentsScrollViewRightPadding = res
- .getDimensionPixelSize(R.dimen.status_bar_recents_right_glow_margin);
- x = (int) (dm.widthPixels - res
- .getDimensionPixelSize(R.dimen.status_bar_recents_thumbnail_width)
- - thumbBgPadding - recentsItemRightPadding
- - recentsScrollViewRightPadding);
- y = (int) ((dm.heightPixels - statusBarHeight - height) / 2f + thumbTopMargin
- + recentsItemTopPadding + thumbBgPadding + statusBarHeight);
- }
-
- ActivityOptions opts = ActivityOptions.makeThumbnailScaleDownAnimation(
- statusBarView,
- first, x, y,
- new ActivityOptions.OnAnimationStartedListener() {
- public void onAnimationStarted() {
- Intent intent =
- new Intent(RecentsActivity.WINDOW_ANIMATION_START_INTENT);
- intent.setPackage("com.android.systemui");
- sendBroadcastSafely(intent);
- }
- });
- intent.putExtra(RecentsActivity.WAITING_FOR_WINDOW_ANIMATION_PARAM, true);
- startActivitySafely(intent, opts.toBundle());
- }
- } catch (ActivityNotFoundException e) {
- Log.e(TAG, "Failed to launch RecentAppsIntent", e);
- }
- }
-
- @Override
- protected void onConfigurationChanged(Configuration newConfig) {
- if (mUseAlternateRecents) {
- sAlternateRecents.onConfigurationChanged(newConfig);
- }
- }
-
- @Override
- public void preloadRecents() {
- if (mUseAlternateRecents) {
- sAlternateRecents.onPreloadRecents();
- } else {
- Intent intent = new Intent(RecentsActivity.PRELOAD_INTENT);
- intent.setClassName("com.android.systemui",
- "com.android.systemui.recent.RecentsPreloadReceiver");
- sendBroadcastSafely(intent);
-
- RecentTasksLoader.getInstance(mContext).preloadFirstTask();
- }
- }
-
- @Override
- public void cancelPreloadingRecents() {
- if (mUseAlternateRecents) {
- sAlternateRecents.onCancelPreloadingRecents();
- } else {
- Intent intent = new Intent(RecentsActivity.CANCEL_PRELOAD_INTENT);
- intent.setClassName("com.android.systemui",
- "com.android.systemui.recent.RecentsPreloadReceiver");
- sendBroadcastSafely(intent);
-
- RecentTasksLoader.getInstance(mContext).cancelPreloadingFirstTask();
- }
- }
-
- @Override
- public void showNextAffiliatedTask() {
- if (mUseAlternateRecents) {
- sAlternateRecents.onShowNextAffiliatedTask();
- }
- }
-
- @Override
- public void showPrevAffiliatedTask() {
- if (mUseAlternateRecents) {
- sAlternateRecents.onShowPrevAffiliatedTask();
- }
- }
-
- @Override
- public void setCallback(Callbacks cb) {
- if (mUseAlternateRecents) {
- sAlternateRecents.setRecentsComponentCallback(cb);
- }
- }
-
- /**
- * Send broadcast only if BOOT_COMPLETED
- */
- private void sendBroadcastSafely(Intent intent) {
- if (!mBootCompleted) return;
- mContext.sendBroadcastAsUser(intent, new UserHandle(UserHandle.USER_CURRENT));
- }
-
- /**
- * Start activity only if BOOT_COMPLETED
- */
- private void startActivitySafely(Intent intent, Bundle opts) {
- if (!mBootCompleted) return;
- mContext.startActivityAsUser(intent, opts, new UserHandle(UserHandle.USER_CURRENT));
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java
deleted file mode 100644
index 7ab40b0..0000000
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.recent;
-
-import android.app.Activity;
-import android.app.ActivityManager;
-import android.app.WallpaperManager;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.Bundle;
-import android.os.UserHandle;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.WindowManager;
-
-import com.android.systemui.R;
-import com.android.systemui.statusbar.StatusBarPanel;
-
-import java.util.List;
-
-public class RecentsActivity extends Activity {
- public static final String TOGGLE_RECENTS_INTENT = "com.android.systemui.recent.action.TOGGLE_RECENTS";
- public static final String PRELOAD_INTENT = "com.android.systemui.recent.action.PRELOAD";
- public static final String CANCEL_PRELOAD_INTENT = "com.android.systemui.recent.CANCEL_PRELOAD";
- public static final String CLOSE_RECENTS_INTENT = "com.android.systemui.recent.action.CLOSE";
- public static final String WINDOW_ANIMATION_START_INTENT = "com.android.systemui.recent.action.WINDOW_ANIMATION_START";
- public static final String PRELOAD_PERMISSION = "com.android.systemui.recent.permission.PRELOAD";
- public static final String WAITING_FOR_WINDOW_ANIMATION_PARAM = "com.android.systemui.recent.WAITING_FOR_WINDOW_ANIMATION";
- private static final String WAS_SHOWING = "was_showing";
-
- private RecentsPanelView mRecentsPanel;
- private IntentFilter mIntentFilter;
- private boolean mShowing;
- private boolean mForeground;
-
- private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (CLOSE_RECENTS_INTENT.equals(intent.getAction())) {
- if (mRecentsPanel != null && mRecentsPanel.isShowing()) {
- if (mShowing && !mForeground) {
- // Captures the case right before we transition to another activity
- mRecentsPanel.show(false);
- }
- }
- } else if (WINDOW_ANIMATION_START_INTENT.equals(intent.getAction())) {
- if (mRecentsPanel != null) {
- mRecentsPanel.onWindowAnimationStart();
- }
- }
- }
- };
-
- public class TouchOutsideListener implements View.OnTouchListener {
- private StatusBarPanel mPanel;
-
- public TouchOutsideListener(StatusBarPanel panel) {
- mPanel = panel;
- }
-
- public boolean onTouch(View v, MotionEvent ev) {
- final int action = ev.getAction();
- if (action == MotionEvent.ACTION_OUTSIDE
- || (action == MotionEvent.ACTION_DOWN
- && !mPanel.isInContentArea((int) ev.getX(), (int) ev.getY()))) {
- dismissAndGoHome();
- return true;
- }
- return false;
- }
- }
-
- @Override
- public void onPause() {
- overridePendingTransition(
- R.anim.recents_return_to_launcher_enter,
- R.anim.recents_return_to_launcher_exit);
- mForeground = false;
- super.onPause();
- }
-
- @Override
- public void onStop() {
- mShowing = false;
- if (mRecentsPanel != null) {
- mRecentsPanel.onUiHidden();
- }
- super.onStop();
- }
-
- private void updateWallpaperVisibility(boolean visible) {
- int wpflags = visible ? WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER : 0;
- int curflags = getWindow().getAttributes().flags
- & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
- if (wpflags != curflags) {
- getWindow().setFlags(wpflags, WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER);
- }
- }
-
- public static boolean forceOpaqueBackground(Context context) {
- return WallpaperManager.getInstance(context).getWallpaperInfo() != null;
- }
-
- @Override
- public void onStart() {
- // Hide wallpaper if it's not a static image
- if (forceOpaqueBackground(this)) {
- updateWallpaperVisibility(false);
- } else {
- updateWallpaperVisibility(true);
- }
- mShowing = true;
- if (mRecentsPanel != null) {
- // Call and refresh the recent tasks list in case we didn't preload tasks
- // or in case we don't get an onNewIntent
- mRecentsPanel.refreshRecentTasksList();
- mRecentsPanel.refreshViews();
- }
- super.onStart();
- }
-
- @Override
- public void onResume() {
- mForeground = true;
- super.onResume();
- }
-
- @Override
- public void onBackPressed() {
- dismissAndGoBack();
- }
-
- public void dismissAndGoHome() {
- if (mRecentsPanel != null) {
- Intent homeIntent = new Intent(Intent.ACTION_MAIN, null);
- homeIntent.addCategory(Intent.CATEGORY_HOME);
- homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
- startActivityAsUser(homeIntent, new UserHandle(UserHandle.USER_CURRENT));
- mRecentsPanel.show(false);
- }
- }
-
- public void dismissAndGoBack() {
- if (mRecentsPanel != null) {
- final ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
-
- final List<ActivityManager.RecentTaskInfo> recentTasks =
- am.getRecentTasks(2,
- ActivityManager.RECENT_WITH_EXCLUDED |
- ActivityManager.RECENT_IGNORE_UNAVAILABLE |
- ActivityManager.RECENT_INCLUDE_PROFILES);
- if (recentTasks.size() > 1 &&
- mRecentsPanel.simulateClick(recentTasks.get(1).persistentId)) {
- // recents panel will take care of calling show(false) through simulateClick
- return;
- }
- mRecentsPanel.show(false);
- }
- finish();
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- getWindow().addPrivateFlags(
- WindowManager.LayoutParams.PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR);
- setContentView(R.layout.status_bar_recent_panel);
- mRecentsPanel = (RecentsPanelView) findViewById(R.id.recents_root);
- mRecentsPanel.setOnTouchListener(new TouchOutsideListener(mRecentsPanel));
- mRecentsPanel.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
-
- final RecentTasksLoader recentTasksLoader = RecentTasksLoader.getInstance(this);
- recentTasksLoader.setRecentsPanel(mRecentsPanel, mRecentsPanel);
- mRecentsPanel.setMinSwipeAlpha(
- getResources().getInteger(R.integer.config_recent_item_min_alpha) / 100f);
-
- if (savedInstanceState == null ||
- savedInstanceState.getBoolean(WAS_SHOWING)) {
- handleIntent(getIntent(), (savedInstanceState == null));
- }
- mIntentFilter = new IntentFilter();
- mIntentFilter.addAction(CLOSE_RECENTS_INTENT);
- mIntentFilter.addAction(WINDOW_ANIMATION_START_INTENT);
- registerReceiver(mIntentReceiver, mIntentFilter);
- super.onCreate(savedInstanceState);
- }
-
- @Override
- protected void onSaveInstanceState(Bundle outState) {
- outState.putBoolean(WAS_SHOWING, mRecentsPanel.isShowing());
- }
-
- @Override
- protected void onDestroy() {
- RecentTasksLoader.getInstance(this).setRecentsPanel(null, mRecentsPanel);
- unregisterReceiver(mIntentReceiver);
- super.onDestroy();
- }
-
- @Override
- protected void onNewIntent(Intent intent) {
- handleIntent(intent, true);
- }
-
- private void handleIntent(Intent intent, boolean checkWaitingForAnimationParam) {
- super.onNewIntent(intent);
-
- if (TOGGLE_RECENTS_INTENT.equals(intent.getAction())) {
- if (mRecentsPanel != null) {
- if (mRecentsPanel.isShowing()) {
- dismissAndGoBack();
- } else {
- final RecentTasksLoader recentTasksLoader = RecentTasksLoader.getInstance(this);
- boolean waitingForWindowAnimation = checkWaitingForAnimationParam &&
- intent.getBooleanExtra(WAITING_FOR_WINDOW_ANIMATION_PARAM, false);
- mRecentsPanel.show(true, recentTasksLoader.getLoadedTasks(),
- recentTasksLoader.isFirstScreenful(), waitingForWindowAnimation);
- }
- }
- }
- }
-
- boolean isForeground() {
- return mForeground;
- }
-
- boolean isActivityShowing() {
- return mShowing;
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java
deleted file mode 100644
index deb5670..0000000
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.recent;
-
-import android.view.View;
-
-public interface RecentsCallback {
- static final int SWIPE_LEFT = 0;
- static final int SWIPE_RIGHT = 1;
- static final int SWIPE_UP = 2;
- static final int SWIPE_DOWN = 3;
-
- void handleOnClick(View selectedView);
- void handleSwipe(View selectedView);
- void handleLongPress(View selectedView, View anchorView, View thumbnailView);
- void dismiss();
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
deleted file mode 100644
index cf5d3a6..0000000
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.recent;
-
-import android.animation.LayoutTransition;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.database.DataSetObserver;
-import android.graphics.Canvas;
-import android.util.AttributeSet;
-import android.util.DisplayMetrics;
-import android.util.Log;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewTreeObserver;
-import android.view.ViewTreeObserver.OnGlobalLayoutListener;
-import android.widget.HorizontalScrollView;
-import android.widget.LinearLayout;
-
-import com.android.systemui.R;
-import com.android.systemui.SwipeHelper;
-import com.android.systemui.recent.RecentsPanelView.TaskDescriptionAdapter;
-
-import java.util.HashSet;
-import java.util.Iterator;
-
-public class RecentsHorizontalScrollView extends HorizontalScrollView
- implements SwipeHelper.Callback, RecentsPanelView.RecentsScrollView {
- private static final String TAG = RecentsPanelView.TAG;
- private static final boolean DEBUG = RecentsPanelView.DEBUG;
- private LinearLayout mLinearLayout;
- private TaskDescriptionAdapter mAdapter;
- private RecentsCallback mCallback;
- protected int mLastScrollPosition;
- private SwipeHelper mSwipeHelper;
- private FadedEdgeDrawHelper mFadedEdgeDrawHelper;
- private HashSet<View> mRecycledViews;
- private int mNumItemsInOneScreenful;
- private Runnable mOnScrollListener;
-
- public RecentsHorizontalScrollView(Context context, AttributeSet attrs) {
- super(context, attrs, 0);
- mSwipeHelper = new SwipeHelper(SwipeHelper.Y, this, context);
- mFadedEdgeDrawHelper = FadedEdgeDrawHelper.create(context, attrs, this, false);
- mRecycledViews = new HashSet<View>();
- }
-
- public void setMinSwipeAlpha(float minAlpha) {
- mSwipeHelper.setMinSwipeProgress(minAlpha);
- }
-
- private int scrollPositionOfMostRecent() {
- return mLinearLayout.getWidth() - getWidth();
- }
-
- private void addToRecycledViews(View v) {
- if (mRecycledViews.size() < mNumItemsInOneScreenful) {
- mRecycledViews.add(v);
- }
- }
-
- public View findViewForTask(int persistentTaskId) {
- for (int i = 0; i < mLinearLayout.getChildCount(); i++) {
- View v = mLinearLayout.getChildAt(i);
- RecentsPanelView.ViewHolder holder = (RecentsPanelView.ViewHolder) v.getTag();
- if (holder.taskDescription.persistentTaskId == persistentTaskId) {
- return v;
- }
- }
- return null;
- }
-
- private void update() {
- for (int i = 0; i < mLinearLayout.getChildCount(); i++) {
- View v = mLinearLayout.getChildAt(i);
- addToRecycledViews(v);
- mAdapter.recycleView(v);
- }
- LayoutTransition transitioner = getLayoutTransition();
- setLayoutTransition(null);
-
- mLinearLayout.removeAllViews();
- Iterator<View> recycledViews = mRecycledViews.iterator();
- for (int i = 0; i < mAdapter.getCount(); i++) {
- View old = null;
- if (recycledViews.hasNext()) {
- old = recycledViews.next();
- recycledViews.remove();
- old.setVisibility(VISIBLE);
- }
-
- final View view = mAdapter.getView(i, old, mLinearLayout);
-
- if (mFadedEdgeDrawHelper != null) {
- mFadedEdgeDrawHelper.addViewCallback(view);
- }
-
- OnTouchListener noOpListener = new OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- return true;
- }
- };
-
- view.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- mCallback.dismiss();
- }
- });
- // We don't want a click sound when we dimiss recents
- view.setSoundEffectsEnabled(false);
-
- OnClickListener launchAppListener = new OnClickListener() {
- public void onClick(View v) {
- mCallback.handleOnClick(view);
- }
- };
-
- RecentsPanelView.ViewHolder holder = (RecentsPanelView.ViewHolder) view.getTag();
- final View thumbnailView = holder.thumbnailView;
- OnLongClickListener longClickListener = new OnLongClickListener() {
- public boolean onLongClick(View v) {
- final View anchorView = view.findViewById(R.id.app_description);
- mCallback.handleLongPress(view, anchorView, thumbnailView);
- return true;
- }
- };
- thumbnailView.setClickable(true);
- thumbnailView.setOnClickListener(launchAppListener);
- thumbnailView.setOnLongClickListener(longClickListener);
-
- // We don't want to dismiss recents if a user clicks on the app title
- // (we also don't want to launch the app either, though, because the
- // app title is a small target and doesn't have great click feedback)
- final View appTitle = view.findViewById(R.id.app_label);
- appTitle.setContentDescription(" ");
- appTitle.setOnTouchListener(noOpListener);
- mLinearLayout.addView(view);
- }
- setLayoutTransition(transitioner);
-
- // Scroll to end after initial layout.
-
- final OnGlobalLayoutListener updateScroll = new OnGlobalLayoutListener() {
- public void onGlobalLayout() {
- mLastScrollPosition = scrollPositionOfMostRecent();
- scrollTo(mLastScrollPosition, 0);
- final ViewTreeObserver observer = getViewTreeObserver();
- if (observer.isAlive()) {
- observer.removeOnGlobalLayoutListener(this);
- }
- }
- };
- getViewTreeObserver().addOnGlobalLayoutListener(updateScroll);
- }
-
- @Override
- public void removeViewInLayout(final View view) {
- dismissChild(view);
- }
-
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (DEBUG) Log.v(TAG, "onInterceptTouchEvent()");
- return mSwipeHelper.onInterceptTouchEvent(ev) ||
- super.onInterceptTouchEvent(ev);
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- return mSwipeHelper.onTouchEvent(ev) ||
- super.onTouchEvent(ev);
- }
-
- public boolean canChildBeDismissed(View v) {
- return true;
- }
-
- @Override
- public boolean isAntiFalsingNeeded() {
- return false;
- }
-
- @Override
- public float getFalsingThresholdFactor() {
- return 1.0f;
- }
-
- public void dismissChild(View v) {
- mSwipeHelper.dismissChild(v, 0);
- }
-
- public void onChildDismissed(View v) {
- addToRecycledViews(v);
- mLinearLayout.removeView(v);
- mCallback.handleSwipe(v);
- // Restore the alpha/translation parameters to what they were before swiping
- // (for when these items are recycled)
- View contentView = getChildContentView(v);
- contentView.setAlpha(1f);
- contentView.setTranslationY(0);
- }
-
- public void onBeginDrag(View v) {
- // We do this so the underlying ScrollView knows that it won't get
- // the chance to intercept events anymore
- requestDisallowInterceptTouchEvent(true);
- }
-
- public void onDragCancelled(View v) {
- }
-
- @Override
- public void onChildSnappedBack(View animView) {
- }
-
- @Override
- public boolean updateSwipeProgress(View animView, boolean dismissable, float swipeProgress) {
- return false;
- }
-
- public View getChildAtPosition(MotionEvent ev) {
- final float x = ev.getX() + getScrollX();
- final float y = ev.getY() + getScrollY();
- for (int i = 0; i < mLinearLayout.getChildCount(); i++) {
- View item = mLinearLayout.getChildAt(i);
- if (x >= item.getLeft() && x < item.getRight()
- && y >= item.getTop() && y < item.getBottom()) {
- return item;
- }
- }
- return null;
- }
-
- public View getChildContentView(View v) {
- return v.findViewById(R.id.recent_item);
- }
-
- @Override
- public void drawFadedEdges(Canvas canvas, int left, int right, int top, int bottom) {
- if (mFadedEdgeDrawHelper != null) {
-
- mFadedEdgeDrawHelper.drawCallback(canvas,
- left, right, top, bottom, getScrollX(), getScrollY(),
- 0, 0,
- getLeftFadingEdgeStrength(), getRightFadingEdgeStrength(), getPaddingTop());
- }
- }
-
- @Override
- protected void onScrollChanged(int l, int t, int oldl, int oldt) {
- super.onScrollChanged(l, t, oldl, oldt);
- if (mOnScrollListener != null) {
- mOnScrollListener.run();
- }
- }
-
- public void setOnScrollListener(Runnable listener) {
- mOnScrollListener = listener;
- }
-
- @Override
- public int getVerticalFadingEdgeLength() {
- if (mFadedEdgeDrawHelper != null) {
- return mFadedEdgeDrawHelper.getVerticalFadingEdgeLength();
- } else {
- return super.getVerticalFadingEdgeLength();
- }
- }
-
- @Override
- public int getHorizontalFadingEdgeLength() {
- if (mFadedEdgeDrawHelper != null) {
- return mFadedEdgeDrawHelper.getHorizontalFadingEdgeLength();
- } else {
- return super.getHorizontalFadingEdgeLength();
- }
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- setScrollbarFadingEnabled(true);
- mLinearLayout = (LinearLayout) findViewById(R.id.recents_linear_layout);
- final int leftPadding = getContext().getResources()
- .getDimensionPixelOffset(R.dimen.status_bar_recents_thumbnail_left_margin);
- setOverScrollEffectPadding(leftPadding, 0);
- }
-
- @Override
- public void onAttachedToWindow() {
- if (mFadedEdgeDrawHelper != null) {
- mFadedEdgeDrawHelper.onAttachedToWindowCallback(mLinearLayout, isHardwareAccelerated());
- }
- }
-
- @Override
- protected void onConfigurationChanged(Configuration newConfig) {
- super.onConfigurationChanged(newConfig);
- float densityScale = getResources().getDisplayMetrics().density;
- mSwipeHelper.setDensityScale(densityScale);
- float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
- mSwipeHelper.setPagingTouchSlop(pagingTouchSlop);
- }
-
- private void setOverScrollEffectPadding(int leftPadding, int i) {
- // TODO Add to (Vertical)ScrollView
- }
-
- @Override
- protected void onSizeChanged(int w, int h, int oldw, int oldh) {
- super.onSizeChanged(w, h, oldw, oldh);
-
- // Skip this work if a transition is running; it sets the scroll values independently
- // and should not have those animated values clobbered by this logic
- LayoutTransition transition = mLinearLayout.getLayoutTransition();
- if (transition != null && transition.isRunning()) {
- return;
- }
- // Keep track of the last visible item in the list so we can restore it
- // to the bottom when the orientation changes.
- mLastScrollPosition = scrollPositionOfMostRecent();
-
- // This has to happen post-layout, so run it "in the future"
- post(new Runnable() {
- public void run() {
- // Make sure we're still not clobbering the transition-set values, since this
- // runnable launches asynchronously
- LayoutTransition transition = mLinearLayout.getLayoutTransition();
- if (transition == null || !transition.isRunning()) {
- scrollTo(mLastScrollPosition, 0);
- }
- }
- });
- }
-
- public void setAdapter(TaskDescriptionAdapter adapter) {
- mAdapter = adapter;
- mAdapter.registerDataSetObserver(new DataSetObserver() {
- public void onChanged() {
- update();
- }
-
- public void onInvalidated() {
- update();
- }
- });
- DisplayMetrics dm = getResources().getDisplayMetrics();
- int childWidthMeasureSpec =
- MeasureSpec.makeMeasureSpec(dm.widthPixels, MeasureSpec.AT_MOST);
- int childheightMeasureSpec =
- MeasureSpec.makeMeasureSpec(dm.heightPixels, MeasureSpec.AT_MOST);
- View child = mAdapter.createView(mLinearLayout);
- child.measure(childWidthMeasureSpec, childheightMeasureSpec);
- mNumItemsInOneScreenful =
- (int) Math.ceil(dm.widthPixels / (double) child.getMeasuredWidth());
- addToRecycledViews(child);
-
- for (int i = 0; i < mNumItemsInOneScreenful - 1; i++) {
- addToRecycledViews(mAdapter.createView(mLinearLayout));
- }
- }
-
- public int numItemsInOneScreenful() {
- return mNumItemsInOneScreenful;
- }
-
- @Override
- public void setLayoutTransition(LayoutTransition transition) {
- // The layout transition applies to our embedded LinearLayout
- mLinearLayout.setLayoutTransition(transition);
- }
-
- public void setCallback(RecentsCallback callback) {
- mCallback = callback;
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
deleted file mode 100644
index 4c3460e..0000000
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ /dev/null
@@ -1,813 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.recent;
-
-import android.animation.Animator;
-import android.animation.LayoutTransition;
-import android.animation.TimeInterpolator;
-import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
-import android.app.ActivityOptions;
-import android.app.TaskStackBuilder;
-import android.content.ActivityNotFoundException;
-import android.content.Context;
-import android.content.Intent;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Matrix;
-import android.graphics.Shader.TileMode;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.RemoteException;
-import android.os.UserHandle;
-import android.provider.Settings;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.MenuItem;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewPropertyAnimator;
-import android.view.ViewRootImpl;
-import android.view.accessibility.AccessibilityEvent;
-import android.view.animation.AnimationUtils;
-import android.view.animation.DecelerateInterpolator;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.BaseAdapter;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.ImageView.ScaleType;
-import android.widget.PopupMenu;
-import android.widget.TextView;
-
-import com.android.systemui.R;
-import com.android.systemui.statusbar.BaseStatusBar;
-import com.android.systemui.statusbar.StatusBarPanel;
-import com.android.systemui.statusbar.phone.PhoneStatusBar;
-
-import java.util.ArrayList;
-
-public class RecentsPanelView extends FrameLayout implements OnItemClickListener, RecentsCallback,
- StatusBarPanel, Animator.AnimatorListener {
- static final String TAG = "RecentsPanelView";
- static final boolean DEBUG = PhoneStatusBar.DEBUG || false;
- private PopupMenu mPopup;
- private View mRecentsScrim;
- private View mRecentsNoApps;
- private RecentsScrollView mRecentsContainer;
-
- private boolean mShowing;
- private boolean mWaitingToShow;
- private ViewHolder mItemToAnimateInWhenWindowAnimationIsFinished;
- private boolean mAnimateIconOfFirstTask;
- private boolean mWaitingForWindowAnimation;
- private long mWindowAnimationStartTime;
- private boolean mCallUiHiddenBeforeNextReload;
-
- private RecentTasksLoader mRecentTasksLoader;
- private ArrayList<TaskDescription> mRecentTaskDescriptions;
- private TaskDescriptionAdapter mListAdapter;
- private int mThumbnailWidth;
- private boolean mFitThumbnailToXY;
- private int mRecentItemLayoutId;
- private boolean mHighEndGfx;
-
- public static interface RecentsScrollView {
- public int numItemsInOneScreenful();
- public void setAdapter(TaskDescriptionAdapter adapter);
- public void setCallback(RecentsCallback callback);
- public void setMinSwipeAlpha(float minAlpha);
- public View findViewForTask(int persistentTaskId);
- public void drawFadedEdges(Canvas c, int left, int right, int top, int bottom);
- public void setOnScrollListener(Runnable listener);
- }
-
- private final class OnLongClickDelegate implements View.OnLongClickListener {
- View mOtherView;
- OnLongClickDelegate(View other) {
- mOtherView = other;
- }
- public boolean onLongClick(View v) {
- return mOtherView.performLongClick();
- }
- }
-
- /* package */ final static class ViewHolder {
- View thumbnailView;
- ImageView thumbnailViewImage;
- Drawable thumbnailViewDrawable;
- ImageView iconView;
- TextView labelView;
- TextView descriptionView;
- View calloutLine;
- TaskDescription taskDescription;
- boolean loadedThumbnailAndIcon;
- }
-
- /* package */ final class TaskDescriptionAdapter extends BaseAdapter {
- private LayoutInflater mInflater;
-
- public TaskDescriptionAdapter(Context context) {
- mInflater = LayoutInflater.from(context);
- }
-
- public int getCount() {
- return mRecentTaskDescriptions != null ? mRecentTaskDescriptions.size() : 0;
- }
-
- public Object getItem(int position) {
- return position; // we only need the index
- }
-
- public long getItemId(int position) {
- return position; // we just need something unique for this position
- }
-
- public View createView(ViewGroup parent) {
- View convertView = mInflater.inflate(mRecentItemLayoutId, parent, false);
- ViewHolder holder = new ViewHolder();
- holder.thumbnailView = convertView.findViewById(R.id.app_thumbnail);
- holder.thumbnailViewImage =
- (ImageView) convertView.findViewById(R.id.app_thumbnail_image);
- // If we set the default thumbnail now, we avoid an onLayout when we update
- // the thumbnail later (if they both have the same dimensions)
- updateThumbnail(holder, mRecentTasksLoader.getDefaultThumbnail(), false, false);
- holder.iconView = (ImageView) convertView.findViewById(R.id.app_icon);
- holder.iconView.setImageDrawable(mRecentTasksLoader.getDefaultIcon());
- holder.labelView = (TextView) convertView.findViewById(R.id.app_label);
- holder.calloutLine = convertView.findViewById(R.id.recents_callout_line);
- holder.descriptionView = (TextView) convertView.findViewById(R.id.app_description);
-
- convertView.setTag(holder);
- return convertView;
- }
-
- public View getView(int position, View convertView, ViewGroup parent) {
- if (convertView == null) {
- convertView = createView(parent);
- }
- final ViewHolder holder = (ViewHolder) convertView.getTag();
-
- // index is reverse since most recent appears at the bottom...
- final int index = mRecentTaskDescriptions.size() - position - 1;
-
- final TaskDescription td = mRecentTaskDescriptions.get(index);
-
- holder.labelView.setText(td.getLabel());
- holder.thumbnailView.setContentDescription(td.getLabel());
- holder.loadedThumbnailAndIcon = td.isLoaded();
- if (td.isLoaded()) {
- updateThumbnail(holder, td.getThumbnail(), true, false);
- updateIcon(holder, td.getIcon(), true, false);
- }
- if (index == 0) {
- if (mAnimateIconOfFirstTask) {
- ViewHolder oldHolder = mItemToAnimateInWhenWindowAnimationIsFinished;
- if (oldHolder != null) {
- oldHolder.iconView.setAlpha(1f);
- oldHolder.iconView.setTranslationX(0f);
- oldHolder.iconView.setTranslationY(0f);
- oldHolder.labelView.setAlpha(1f);
- oldHolder.labelView.setTranslationX(0f);
- oldHolder.labelView.setTranslationY(0f);
- if (oldHolder.calloutLine != null) {
- oldHolder.calloutLine.setAlpha(1f);
- oldHolder.calloutLine.setTranslationX(0f);
- oldHolder.calloutLine.setTranslationY(0f);
- }
- }
- mItemToAnimateInWhenWindowAnimationIsFinished = holder;
- int translation = -getResources().getDimensionPixelSize(
- R.dimen.status_bar_recents_app_icon_translate_distance);
- final Configuration config = getResources().getConfiguration();
- if (config.orientation == Configuration.ORIENTATION_PORTRAIT) {
- if (getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
- translation = -translation;
- }
- holder.iconView.setAlpha(0f);
- holder.iconView.setTranslationX(translation);
- holder.labelView.setAlpha(0f);
- holder.labelView.setTranslationX(translation);
- holder.calloutLine.setAlpha(0f);
- holder.calloutLine.setTranslationX(translation);
- } else {
- holder.iconView.setAlpha(0f);
- holder.iconView.setTranslationY(translation);
- }
- if (!mWaitingForWindowAnimation) {
- animateInIconOfFirstTask();
- }
- }
- }
-
- holder.thumbnailView.setTag(td);
- holder.thumbnailView.setOnLongClickListener(new OnLongClickDelegate(convertView));
- holder.taskDescription = td;
- return convertView;
- }
-
- public void recycleView(View v) {
- ViewHolder holder = (ViewHolder) v.getTag();
- updateThumbnail(holder, mRecentTasksLoader.getDefaultThumbnail(), false, false);
- holder.iconView.setImageDrawable(mRecentTasksLoader.getDefaultIcon());
- holder.iconView.setVisibility(INVISIBLE);
- holder.iconView.animate().cancel();
- holder.labelView.setText(null);
- holder.labelView.animate().cancel();
- holder.thumbnailView.setContentDescription(null);
- holder.thumbnailView.setTag(null);
- holder.thumbnailView.setOnLongClickListener(null);
- holder.thumbnailView.setVisibility(INVISIBLE);
- holder.iconView.setAlpha(1f);
- holder.iconView.setTranslationX(0f);
- holder.iconView.setTranslationY(0f);
- holder.labelView.setAlpha(1f);
- holder.labelView.setTranslationX(0f);
- holder.labelView.setTranslationY(0f);
- if (holder.calloutLine != null) {
- holder.calloutLine.setAlpha(1f);
- holder.calloutLine.setTranslationX(0f);
- holder.calloutLine.setTranslationY(0f);
- holder.calloutLine.animate().cancel();
- }
- holder.taskDescription = null;
- holder.loadedThumbnailAndIcon = false;
- }
- }
-
- public RecentsPanelView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public RecentsPanelView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- updateValuesFromResources();
-
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RecentsPanelView,
- defStyle, 0);
-
- mRecentItemLayoutId = a.getResourceId(R.styleable.RecentsPanelView_recentItemLayout, 0);
- mRecentTasksLoader = RecentTasksLoader.getInstance(context);
- a.recycle();
- }
-
- public int numItemsInOneScreenful() {
- return mRecentsContainer.numItemsInOneScreenful();
- }
-
- private boolean pointInside(int x, int y, View v) {
- final int l = v.getLeft();
- final int r = v.getRight();
- final int t = v.getTop();
- final int b = v.getBottom();
- return x >= l && x < r && y >= t && y < b;
- }
-
- public boolean isInContentArea(int x, int y) {
- return pointInside(x, y, (View) mRecentsContainer);
- }
-
- public void show(boolean show) {
- show(show, null, false, false);
- }
-
- public void show(boolean show, ArrayList<TaskDescription> recentTaskDescriptions,
- boolean firstScreenful, boolean animateIconOfFirstTask) {
- if (show && mCallUiHiddenBeforeNextReload) {
- onUiHidden();
- recentTaskDescriptions = null;
- mAnimateIconOfFirstTask = false;
- mWaitingForWindowAnimation = false;
- } else {
- mAnimateIconOfFirstTask = animateIconOfFirstTask;
- mWaitingForWindowAnimation = animateIconOfFirstTask;
- }
- if (show) {
- mWaitingToShow = true;
- refreshRecentTasksList(recentTaskDescriptions, firstScreenful);
- showIfReady();
- } else {
- showImpl(false);
- }
- }
-
- private void showIfReady() {
- // mWaitingToShow => there was a touch up on the recents button
- // mRecentTaskDescriptions != null => we've created views for the first screenful of items
- if (mWaitingToShow && mRecentTaskDescriptions != null) {
- showImpl(true);
- }
- }
-
- static void sendCloseSystemWindows(Context context, String reason) {
- if (ActivityManagerNative.isSystemReady()) {
- try {
- ActivityManagerNative.getDefault().closeSystemDialogs(reason);
- } catch (RemoteException e) {
- }
- }
- }
-
- private void showImpl(boolean show) {
- sendCloseSystemWindows(getContext(), BaseStatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS);
-
- mShowing = show;
-
- if (show) {
- // if there are no apps, bring up a "No recent apps" message
- boolean noApps = mRecentTaskDescriptions != null
- && (mRecentTaskDescriptions.size() == 0);
- mRecentsNoApps.setAlpha(1f);
- mRecentsNoApps.setVisibility(noApps ? View.VISIBLE : View.INVISIBLE);
-
- onAnimationEnd(null);
- setFocusable(true);
- setFocusableInTouchMode(true);
- requestFocus();
- } else {
- mWaitingToShow = false;
- // call onAnimationEnd() and clearRecentTasksList() in onUiHidden()
- mCallUiHiddenBeforeNextReload = true;
- if (mPopup != null) {
- mPopup.dismiss();
- }
- }
- }
-
- protected void onAttachedToWindow () {
- super.onAttachedToWindow();
- final ViewRootImpl root = getViewRootImpl();
- if (root != null) {
- root.setDrawDuringWindowsAnimating(true);
- }
- }
-
- public void onUiHidden() {
- mCallUiHiddenBeforeNextReload = false;
- if (!mShowing && mRecentTaskDescriptions != null) {
- onAnimationEnd(null);
- clearRecentTasksList();
- }
- }
-
- public void dismiss() {
- ((RecentsActivity) getContext()).dismissAndGoHome();
- }
-
- public void dismissAndGoBack() {
- ((RecentsActivity) getContext()).dismissAndGoBack();
- }
-
- public void onAnimationCancel(Animator animation) {
- }
-
- public void onAnimationEnd(Animator animation) {
- if (mShowing) {
- final LayoutTransition transitioner = new LayoutTransition();
- ((ViewGroup)mRecentsContainer).setLayoutTransition(transitioner);
- createCustomAnimations(transitioner);
- } else {
- ((ViewGroup)mRecentsContainer).setLayoutTransition(null);
- }
- }
-
- public void onAnimationRepeat(Animator animation) {
- }
-
- public void onAnimationStart(Animator animation) {
- }
-
- @Override
- public boolean dispatchHoverEvent(MotionEvent event) {
- // Ignore hover events outside of this panel bounds since such events
- // generate spurious accessibility events with the panel content when
- // tapping outside of it, thus confusing the user.
- final int x = (int) event.getX();
- final int y = (int) event.getY();
- if (x >= 0 && x < getWidth() && y >= 0 && y < getHeight()) {
- return super.dispatchHoverEvent(event);
- }
- return true;
- }
-
- /**
- * Whether the panel is showing, or, if it's animating, whether it will be
- * when the animation is done.
- */
- public boolean isShowing() {
- return mShowing;
- }
-
- public void setRecentTasksLoader(RecentTasksLoader loader) {
- mRecentTasksLoader = loader;
- }
-
- public void updateValuesFromResources() {
- final Resources res = getContext().getResources();
- mThumbnailWidth = Math.round(res.getDimension(R.dimen.status_bar_recents_thumbnail_width));
- mFitThumbnailToXY = res.getBoolean(R.bool.config_recents_thumbnail_image_fits_to_xy);
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
-
- mRecentsContainer = (RecentsScrollView) findViewById(R.id.recents_container);
- mRecentsContainer.setOnScrollListener(new Runnable() {
- public void run() {
- // need to redraw the faded edges
- invalidate();
- }
- });
- mListAdapter = new TaskDescriptionAdapter(getContext());
- mRecentsContainer.setAdapter(mListAdapter);
- mRecentsContainer.setCallback(this);
-
- mRecentsScrim = findViewById(R.id.recents_bg_protect);
- mRecentsNoApps = findViewById(R.id.recents_no_apps);
-
- if (mRecentsScrim != null) {
- mHighEndGfx = ActivityManager.isHighEndGfx();
- if (!mHighEndGfx) {
- mRecentsScrim.setBackground(null);
- } else if (mRecentsScrim.getBackground() instanceof BitmapDrawable) {
- // In order to save space, we make the background texture repeat in the Y direction
- ((BitmapDrawable) mRecentsScrim.getBackground()).setTileModeY(TileMode.REPEAT);
- }
- }
- }
-
- public void setMinSwipeAlpha(float minAlpha) {
- mRecentsContainer.setMinSwipeAlpha(minAlpha);
- }
-
- private void createCustomAnimations(LayoutTransition transitioner) {
- transitioner.setDuration(200);
- transitioner.setStartDelay(LayoutTransition.CHANGE_DISAPPEARING, 0);
- transitioner.setAnimator(LayoutTransition.DISAPPEARING, null);
- }
-
- private void updateIcon(ViewHolder h, Drawable icon, boolean show, boolean anim) {
- if (icon != null) {
- h.iconView.setImageDrawable(icon);
- if (show && h.iconView.getVisibility() != View.VISIBLE) {
- if (anim) {
- h.iconView.setAnimation(
- AnimationUtils.loadAnimation(getContext(), R.anim.recent_appear));
- }
- h.iconView.setVisibility(View.VISIBLE);
- }
- }
- }
-
- private void updateThumbnail(ViewHolder h, Drawable thumbnail, boolean show, boolean anim) {
- if (thumbnail != null) {
- // Should remove the default image in the frame
- // that this now covers, to improve scrolling speed.
- // That can't be done until the anim is complete though.
- h.thumbnailViewImage.setImageDrawable(thumbnail);
-
- // scale the image to fill the full width of the ImageView. do this only if
- // we haven't set a bitmap before, or if the bitmap size has changed
- if (h.thumbnailViewDrawable == null ||
- h.thumbnailViewDrawable.getIntrinsicWidth() != thumbnail.getIntrinsicWidth() ||
- h.thumbnailViewDrawable.getIntrinsicHeight() != thumbnail.getIntrinsicHeight()) {
- if (mFitThumbnailToXY) {
- h.thumbnailViewImage.setScaleType(ScaleType.FIT_XY);
- } else {
- Matrix scaleMatrix = new Matrix();
- float scale = mThumbnailWidth / (float) thumbnail.getIntrinsicWidth();
- scaleMatrix.setScale(scale, scale);
- h.thumbnailViewImage.setScaleType(ScaleType.MATRIX);
- h.thumbnailViewImage.setImageMatrix(scaleMatrix);
- }
- }
- if (show && h.thumbnailView.getVisibility() != View.VISIBLE) {
- if (anim) {
- h.thumbnailView.setAnimation(
- AnimationUtils.loadAnimation(getContext(), R.anim.recent_appear));
- }
- h.thumbnailView.setVisibility(View.VISIBLE);
- }
- h.thumbnailViewDrawable = thumbnail;
- }
- }
-
- void onTaskThumbnailLoaded(TaskDescription td) {
- synchronized (td) {
- if (mRecentsContainer != null) {
- ViewGroup container = (ViewGroup) mRecentsContainer;
- if (container instanceof RecentsScrollView) {
- container = (ViewGroup) container.findViewById(
- R.id.recents_linear_layout);
- }
- // Look for a view showing this thumbnail, to update.
- for (int i=0; i < container.getChildCount(); i++) {
- View v = container.getChildAt(i);
- if (v.getTag() instanceof ViewHolder) {
- ViewHolder h = (ViewHolder)v.getTag();
- if (!h.loadedThumbnailAndIcon && h.taskDescription == td) {
- // only fade in the thumbnail if recents is already visible-- we
- // show it immediately otherwise
- //boolean animateShow = mShowing &&
- // mRecentsContainer.getAlpha() > ViewConfiguration.ALPHA_THRESHOLD;
- boolean animateShow = false;
- updateIcon(h, td.getIcon(), true, animateShow);
- updateThumbnail(h, td.getThumbnail(), true, animateShow);
- h.loadedThumbnailAndIcon = true;
- }
- }
- }
- }
- }
- showIfReady();
- }
-
- private void animateInIconOfFirstTask() {
- if (mItemToAnimateInWhenWindowAnimationIsFinished != null &&
- !mRecentTasksLoader.isFirstScreenful()) {
- int timeSinceWindowAnimation =
- (int) (System.currentTimeMillis() - mWindowAnimationStartTime);
- final int minStartDelay = 150;
- final int startDelay = Math.max(0, Math.min(
- minStartDelay - timeSinceWindowAnimation, minStartDelay));
- final int duration = 250;
- final ViewHolder holder = mItemToAnimateInWhenWindowAnimationIsFinished;
- final TimeInterpolator cubic = new DecelerateInterpolator(1.5f);
- FirstFrameAnimatorHelper.initializeDrawListener(holder.iconView);
- for (View v :
- new View[] { holder.iconView, holder.labelView, holder.calloutLine }) {
- if (v != null) {
- ViewPropertyAnimator vpa = v.animate().translationX(0).translationY(0)
- .alpha(1f).setStartDelay(startDelay)
- .setDuration(duration).setInterpolator(cubic);
- FirstFrameAnimatorHelper h = new FirstFrameAnimatorHelper(vpa, v);
- }
- }
- mItemToAnimateInWhenWindowAnimationIsFinished = null;
- mAnimateIconOfFirstTask = false;
- }
- }
-
- public void onWindowAnimationStart() {
- mWaitingForWindowAnimation = false;
- mWindowAnimationStartTime = System.currentTimeMillis();
- animateInIconOfFirstTask();
- }
-
- public void clearRecentTasksList() {
- // Clear memory used by screenshots
- if (mRecentTaskDescriptions != null) {
- mRecentTasksLoader.cancelLoadingThumbnailsAndIcons(this);
- onTaskLoadingCancelled();
- }
- }
-
- public void onTaskLoadingCancelled() {
- // Gets called by RecentTasksLoader when it's cancelled
- if (mRecentTaskDescriptions != null) {
- mRecentTaskDescriptions = null;
- mListAdapter.notifyDataSetInvalidated();
- }
- }
-
- public void refreshViews() {
- mListAdapter.notifyDataSetInvalidated();
- updateUiElements();
- showIfReady();
- }
-
- public void refreshRecentTasksList() {
- refreshRecentTasksList(null, false);
- }
-
- private void refreshRecentTasksList(
- ArrayList<TaskDescription> recentTasksList, boolean firstScreenful) {
- if (mRecentTaskDescriptions == null && recentTasksList != null) {
- onTasksLoaded(recentTasksList, firstScreenful);
- } else {
- mRecentTasksLoader.loadTasksInBackground();
- }
- }
-
- public void onTasksLoaded(ArrayList<TaskDescription> tasks, boolean firstScreenful) {
- if (mRecentTaskDescriptions == null) {
- mRecentTaskDescriptions = new ArrayList<TaskDescription>(tasks);
- } else {
- mRecentTaskDescriptions.addAll(tasks);
- }
- if (((RecentsActivity) getContext()).isActivityShowing()) {
- refreshViews();
- }
- }
-
- private void updateUiElements() {
- final int items = mRecentTaskDescriptions != null
- ? mRecentTaskDescriptions.size() : 0;
-
- ((View) mRecentsContainer).setVisibility(items > 0 ? View.VISIBLE : View.GONE);
-
- // Set description for accessibility
- int numRecentApps = mRecentTaskDescriptions != null
- ? mRecentTaskDescriptions.size() : 0;
- String recentAppsAccessibilityDescription;
- if (numRecentApps == 0) {
- recentAppsAccessibilityDescription =
- getResources().getString(R.string.status_bar_no_recent_apps);
- } else {
- recentAppsAccessibilityDescription = getResources().getQuantityString(
- R.plurals.status_bar_accessibility_recent_apps, numRecentApps, numRecentApps);
- }
- setContentDescription(recentAppsAccessibilityDescription);
- }
-
- public boolean simulateClick(int persistentTaskId) {
- View v = mRecentsContainer.findViewForTask(persistentTaskId);
- if (v != null) {
- handleOnClick(v);
- return true;
- }
- return false;
- }
-
- public void handleOnClick(View view) {
- ViewHolder holder = (ViewHolder) view.getTag();
- TaskDescription ad = holder.taskDescription;
- final Context context = view.getContext();
- final ActivityManager am = (ActivityManager)
- context.getSystemService(Context.ACTIVITY_SERVICE);
-
- Bitmap bm = null;
- boolean usingDrawingCache = true;
- if (holder.thumbnailViewDrawable instanceof BitmapDrawable) {
- bm = ((BitmapDrawable) holder.thumbnailViewDrawable).getBitmap();
- if (bm.getWidth() == holder.thumbnailViewImage.getWidth() &&
- bm.getHeight() == holder.thumbnailViewImage.getHeight()) {
- usingDrawingCache = false;
- }
- }
- if (usingDrawingCache) {
- holder.thumbnailViewImage.setDrawingCacheEnabled(true);
- bm = holder.thumbnailViewImage.getDrawingCache();
- }
- Bundle opts = (bm == null) ?
- null :
- ActivityOptions.makeThumbnailScaleUpAnimation(
- holder.thumbnailViewImage, bm, 0, 0, null).toBundle();
-
- show(false);
- if (ad.taskId >= 0) {
- // This is an active task; it should just go to the foreground.
- am.moveTaskToFront(ad.taskId, ActivityManager.MOVE_TASK_WITH_HOME,
- opts);
- } else {
- Intent intent = ad.intent;
- intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
- | Intent.FLAG_ACTIVITY_TASK_ON_HOME
- | Intent.FLAG_ACTIVITY_NEW_TASK);
- if (DEBUG) Log.v(TAG, "Starting activity " + intent);
- try {
- context.startActivityAsUser(intent, opts,
- new UserHandle(ad.userId));
- } catch (SecurityException e) {
- Log.e(TAG, "Recents does not have the permission to launch " + intent, e);
- } catch (ActivityNotFoundException e) {
- Log.e(TAG, "Error launching activity " + intent, e);
- }
- }
- if (usingDrawingCache) {
- holder.thumbnailViewImage.setDrawingCacheEnabled(false);
- }
- }
-
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
- handleOnClick(view);
- }
-
- public void handleSwipe(View view) {
- TaskDescription ad = ((ViewHolder) view.getTag()).taskDescription;
- if (ad == null) {
- Log.v(TAG, "Not able to find activity description for swiped task; view=" + view +
- " tag=" + view.getTag());
- return;
- }
- if (DEBUG) Log.v(TAG, "Jettison " + ad.getLabel());
- mRecentTaskDescriptions.remove(ad);
- mRecentTasksLoader.remove(ad);
-
- // Handled by widget containers to enable LayoutTransitions properly
- // mListAdapter.notifyDataSetChanged();
-
- if (mRecentTaskDescriptions.size() == 0) {
- dismissAndGoBack();
- }
-
- // Currently, either direction means the same thing, so ignore direction and remove
- // the task.
- final ActivityManager am = (ActivityManager)
- getContext().getSystemService(Context.ACTIVITY_SERVICE);
- if (am != null) {
- am.removeTask(ad.persistentTaskId);
-
- // Accessibility feedback
- setContentDescription(
- getContext().getString(R.string.accessibility_recents_item_dismissed, ad.getLabel()));
- sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
- setContentDescription(null);
- }
- }
-
- private void startApplicationDetailsActivity(String packageName, int userId) {
- Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
- Uri.fromParts("package", packageName, null));
- intent.setComponent(intent.resolveActivity(getContext().getPackageManager()));
- TaskStackBuilder.create(getContext())
- .addNextIntentWithParentStack(intent).startActivities(null, new UserHandle(userId));
- }
-
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (mPopup != null) {
- return true;
- } else {
- return super.onInterceptTouchEvent(ev);
- }
- }
-
- public void handleLongPress(
- final View selectedView, final View anchorView, final View thumbnailView) {
- thumbnailView.setSelected(true);
- final PopupMenu popup =
- new PopupMenu(getContext(), anchorView == null ? selectedView : anchorView);
- mPopup = popup;
- popup.getMenuInflater().inflate(R.menu.recent_popup_menu, popup.getMenu());
- popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
- public boolean onMenuItemClick(MenuItem item) {
- if (item.getItemId() == R.id.recent_remove_item) {
- ((ViewGroup) mRecentsContainer).removeViewInLayout(selectedView);
- } else if (item.getItemId() == R.id.recent_inspect_item) {
- ViewHolder viewHolder = (ViewHolder) selectedView.getTag();
- if (viewHolder != null) {
- final TaskDescription ad = viewHolder.taskDescription;
- startApplicationDetailsActivity(ad.packageName, ad.userId);
- show(false);
- } else {
- throw new IllegalStateException("Oops, no tag on view " + selectedView);
- }
- } else {
- return false;
- }
- return true;
- }
- });
- popup.setOnDismissListener(new PopupMenu.OnDismissListener() {
- public void onDismiss(PopupMenu menu) {
- thumbnailView.setSelected(false);
- mPopup = null;
- }
- });
- popup.show();
- }
-
- @Override
- protected void dispatchDraw(Canvas canvas) {
- super.dispatchDraw(canvas);
-
- int paddingLeft = getPaddingLeft();
- final boolean offsetRequired = isPaddingOffsetRequired();
- if (offsetRequired) {
- paddingLeft += getLeftPaddingOffset();
- }
-
- int left = getScrollX() + paddingLeft;
- int right = left + getRight() - getLeft() - getPaddingRight() - paddingLeft;
- int top = getScrollY() + getFadeTop(offsetRequired);
- int bottom = top + getFadeHeight(offsetRequired);
-
- if (offsetRequired) {
- right += getRightPaddingOffset();
- bottom += getBottomPaddingOffset();
- }
- mRecentsContainer.drawFadedEdges(canvas, left, right, top, bottom);
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPreloadReceiver.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPreloadReceiver.java
deleted file mode 100644
index eb5892007..0000000
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPreloadReceiver.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.recent;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-
-public class RecentsPreloadReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (RecentsActivity.PRELOAD_INTENT.equals(intent.getAction())) {
- RecentTasksLoader.getInstance(context).preloadRecentTasksList();
- } else if (RecentsActivity.CANCEL_PRELOAD_INTENT.equals(intent.getAction())){
- RecentTasksLoader.getInstance(context).cancelPreloadingRecentTasksList();
- }
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
deleted file mode 100644
index d518f74..0000000
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.recent;
-
-import android.animation.LayoutTransition;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.database.DataSetObserver;
-import android.graphics.Canvas;
-import android.util.AttributeSet;
-import android.util.DisplayMetrics;
-import android.util.Log;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewTreeObserver;
-import android.view.ViewTreeObserver.OnGlobalLayoutListener;
-import android.widget.LinearLayout;
-import android.widget.ScrollView;
-
-import com.android.systemui.R;
-import com.android.systemui.SwipeHelper;
-import com.android.systemui.recent.RecentsPanelView.TaskDescriptionAdapter;
-
-import java.util.HashSet;
-import java.util.Iterator;
-
-public class RecentsVerticalScrollView extends ScrollView
- implements SwipeHelper.Callback, RecentsPanelView.RecentsScrollView {
- private static final String TAG = RecentsPanelView.TAG;
- private static final boolean DEBUG = RecentsPanelView.DEBUG;
- private LinearLayout mLinearLayout;
- private TaskDescriptionAdapter mAdapter;
- private RecentsCallback mCallback;
- protected int mLastScrollPosition;
- private SwipeHelper mSwipeHelper;
- private FadedEdgeDrawHelper mFadedEdgeDrawHelper;
- private HashSet<View> mRecycledViews;
- private int mNumItemsInOneScreenful;
- private Runnable mOnScrollListener;
-
- public RecentsVerticalScrollView(Context context, AttributeSet attrs) {
- super(context, attrs, 0);
- mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, context);
-
- mFadedEdgeDrawHelper = FadedEdgeDrawHelper.create(context, attrs, this, true);
- mRecycledViews = new HashSet<View>();
- }
-
- public void setMinSwipeAlpha(float minAlpha) {
- mSwipeHelper.setMinSwipeProgress(minAlpha);
- }
-
- private int scrollPositionOfMostRecent() {
- return mLinearLayout.getHeight() - getHeight() + getPaddingTop();
- }
-
- private void addToRecycledViews(View v) {
- if (mRecycledViews.size() < mNumItemsInOneScreenful) {
- mRecycledViews.add(v);
- }
- }
-
- public View findViewForTask(int persistentTaskId) {
- for (int i = 0; i < mLinearLayout.getChildCount(); i++) {
- View v = mLinearLayout.getChildAt(i);
- RecentsPanelView.ViewHolder holder = (RecentsPanelView.ViewHolder) v.getTag();
- if (holder.taskDescription.persistentTaskId == persistentTaskId) {
- return v;
- }
- }
- return null;
- }
-
- private void update() {
- for (int i = 0; i < mLinearLayout.getChildCount(); i++) {
- View v = mLinearLayout.getChildAt(i);
- addToRecycledViews(v);
- mAdapter.recycleView(v);
- }
- LayoutTransition transitioner = getLayoutTransition();
- setLayoutTransition(null);
-
- mLinearLayout.removeAllViews();
-
- // Once we can clear the data associated with individual item views,
- // we can get rid of the removeAllViews() and the code below will
- // recycle them.
- Iterator<View> recycledViews = mRecycledViews.iterator();
- for (int i = 0; i < mAdapter.getCount(); i++) {
- View old = null;
- if (recycledViews.hasNext()) {
- old = recycledViews.next();
- recycledViews.remove();
- old.setVisibility(VISIBLE);
- }
- final View view = mAdapter.getView(i, old, mLinearLayout);
-
- if (mFadedEdgeDrawHelper != null) {
- mFadedEdgeDrawHelper.addViewCallback(view);
- }
-
- OnTouchListener noOpListener = new OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- return true;
- }
- };
-
- view.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- mCallback.dismiss();
- }
- });
- // We don't want a click sound when we dimiss recents
- view.setSoundEffectsEnabled(false);
-
- OnClickListener launchAppListener = new OnClickListener() {
- public void onClick(View v) {
- mCallback.handleOnClick(view);
- }
- };
-
- RecentsPanelView.ViewHolder holder = (RecentsPanelView.ViewHolder) view.getTag();
- final View thumbnailView = holder.thumbnailView;
- OnLongClickListener longClickListener = new OnLongClickListener() {
- public boolean onLongClick(View v) {
- final View anchorView = view.findViewById(R.id.app_description);
- mCallback.handleLongPress(view, anchorView, thumbnailView);
- return true;
- }
- };
- thumbnailView.setClickable(true);
- thumbnailView.setOnClickListener(launchAppListener);
- thumbnailView.setOnLongClickListener(longClickListener);
-
- // We don't want to dismiss recents if a user clicks on the app title
- // (we also don't want to launch the app either, though, because the
- // app title is a small target and doesn't have great click feedback)
- final View appTitle = view.findViewById(R.id.app_label);
- appTitle.setContentDescription(" ");
- appTitle.setOnTouchListener(noOpListener);
- final View calloutLine = view.findViewById(R.id.recents_callout_line);
- if (calloutLine != null) {
- calloutLine.setOnTouchListener(noOpListener);
- }
-
- mLinearLayout.addView(view);
- }
- setLayoutTransition(transitioner);
-
- // Scroll to end after initial layout.
- final OnGlobalLayoutListener updateScroll = new OnGlobalLayoutListener() {
- public void onGlobalLayout() {
- mLastScrollPosition = scrollPositionOfMostRecent();
- scrollTo(0, mLastScrollPosition);
- final ViewTreeObserver observer = getViewTreeObserver();
- if (observer.isAlive()) {
- observer.removeOnGlobalLayoutListener(this);
- }
- }
- };
- getViewTreeObserver().addOnGlobalLayoutListener(updateScroll);
- }
-
- @Override
- public void removeViewInLayout(final View view) {
- dismissChild(view);
- }
-
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (DEBUG) Log.v(TAG, "onInterceptTouchEvent()");
- return mSwipeHelper.onInterceptTouchEvent(ev) ||
- super.onInterceptTouchEvent(ev);
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- return mSwipeHelper.onTouchEvent(ev) ||
- super.onTouchEvent(ev);
- }
-
- public boolean canChildBeDismissed(View v) {
- return true;
- }
-
- @Override
- public boolean isAntiFalsingNeeded() {
- return false;
- }
-
- @Override
- public float getFalsingThresholdFactor() {
- return 1.0f;
- }
-
- public void dismissChild(View v) {
- mSwipeHelper.dismissChild(v, 0);
- }
-
- public void onChildDismissed(View v) {
- addToRecycledViews(v);
- mLinearLayout.removeView(v);
- mCallback.handleSwipe(v);
- // Restore the alpha/translation parameters to what they were before swiping
- // (for when these items are recycled)
- View contentView = getChildContentView(v);
- contentView.setAlpha(1f);
- contentView.setTranslationX(0);
- }
-
- public void onBeginDrag(View v) {
- // We do this so the underlying ScrollView knows that it won't get
- // the chance to intercept events anymore
- requestDisallowInterceptTouchEvent(true);
- }
-
- public void onDragCancelled(View v) {
- }
-
- @Override
- public void onChildSnappedBack(View animView) {
- }
-
- @Override
- public boolean updateSwipeProgress(View animView, boolean dismissable, float swipeProgress) {
- return false;
- }
-
- public View getChildAtPosition(MotionEvent ev) {
- final float x = ev.getX() + getScrollX();
- final float y = ev.getY() + getScrollY();
- for (int i = 0; i < mLinearLayout.getChildCount(); i++) {
- View item = mLinearLayout.getChildAt(i);
- if (item.getVisibility() == View.VISIBLE
- && x >= item.getLeft() && x < item.getRight()
- && y >= item.getTop() && y < item.getBottom()) {
- return item;
- }
- }
- return null;
- }
-
- public View getChildContentView(View v) {
- return v.findViewById(R.id.recent_item);
- }
-
- @Override
- public void drawFadedEdges(Canvas canvas, int left, int right, int top, int bottom) {
- if (mFadedEdgeDrawHelper != null) {
- final boolean offsetRequired = isPaddingOffsetRequired();
- mFadedEdgeDrawHelper.drawCallback(canvas,
- left, right, top + getFadeTop(offsetRequired), bottom, getScrollX(), getScrollY(),
- getTopFadingEdgeStrength(), getBottomFadingEdgeStrength(),
- 0, 0, getPaddingTop());
- }
- }
-
- @Override
- protected void onScrollChanged(int l, int t, int oldl, int oldt) {
- super.onScrollChanged(l, t, oldl, oldt);
- if (mOnScrollListener != null) {
- mOnScrollListener.run();
- }
- }
-
- public void setOnScrollListener(Runnable listener) {
- mOnScrollListener = listener;
- }
-
- @Override
- public int getVerticalFadingEdgeLength() {
- if (mFadedEdgeDrawHelper != null) {
- return mFadedEdgeDrawHelper.getVerticalFadingEdgeLength();
- } else {
- return super.getVerticalFadingEdgeLength();
- }
- }
-
- @Override
- public int getHorizontalFadingEdgeLength() {
- if (mFadedEdgeDrawHelper != null) {
- return mFadedEdgeDrawHelper.getHorizontalFadingEdgeLength();
- } else {
- return super.getHorizontalFadingEdgeLength();
- }
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- setScrollbarFadingEnabled(true);
- mLinearLayout = (LinearLayout) findViewById(R.id.recents_linear_layout);
- final int leftPadding = getContext().getResources()
- .getDimensionPixelOffset(R.dimen.status_bar_recents_thumbnail_left_margin);
- setOverScrollEffectPadding(leftPadding, 0);
- }
-
- @Override
- public void onAttachedToWindow() {
- if (mFadedEdgeDrawHelper != null) {
- mFadedEdgeDrawHelper.onAttachedToWindowCallback(mLinearLayout, isHardwareAccelerated());
- }
- }
-
- @Override
- protected void onConfigurationChanged(Configuration newConfig) {
- super.onConfigurationChanged(newConfig);
- float densityScale = getResources().getDisplayMetrics().density;
- mSwipeHelper.setDensityScale(densityScale);
- float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
- mSwipeHelper.setPagingTouchSlop(pagingTouchSlop);
- }
-
- private void setOverScrollEffectPadding(int leftPadding, int i) {
- // TODO Add to (Vertical)ScrollView
- }
-
- @Override
- protected void onSizeChanged(int w, int h, int oldw, int oldh) {
- super.onSizeChanged(w, h, oldw, oldh);
-
- // Skip this work if a transition is running; it sets the scroll values independently
- // and should not have those animated values clobbered by this logic
- LayoutTransition transition = mLinearLayout.getLayoutTransition();
- if (transition != null && transition.isRunning()) {
- return;
- }
- // Keep track of the last visible item in the list so we can restore it
- // to the bottom when the orientation changes.
- mLastScrollPosition = scrollPositionOfMostRecent();
-
- // This has to happen post-layout, so run it "in the future"
- post(new Runnable() {
- public void run() {
- // Make sure we're still not clobbering the transition-set values, since this
- // runnable launches asynchronously
- LayoutTransition transition = mLinearLayout.getLayoutTransition();
- if (transition == null || !transition.isRunning()) {
- scrollTo(0, mLastScrollPosition);
- }
- }
- });
- }
-
- public void setAdapter(TaskDescriptionAdapter adapter) {
- mAdapter = adapter;
- mAdapter.registerDataSetObserver(new DataSetObserver() {
- public void onChanged() {
- update();
- }
-
- public void onInvalidated() {
- update();
- }
- });
-
- DisplayMetrics dm = getResources().getDisplayMetrics();
- int childWidthMeasureSpec =
- MeasureSpec.makeMeasureSpec(dm.widthPixels, MeasureSpec.AT_MOST);
- int childheightMeasureSpec =
- MeasureSpec.makeMeasureSpec(dm.heightPixels, MeasureSpec.AT_MOST);
- View child = mAdapter.createView(mLinearLayout);
- child.measure(childWidthMeasureSpec, childheightMeasureSpec);
- mNumItemsInOneScreenful =
- (int) Math.ceil(dm.heightPixels / (double) child.getMeasuredHeight());
- addToRecycledViews(child);
-
- for (int i = 0; i < mNumItemsInOneScreenful - 1; i++) {
- addToRecycledViews(mAdapter.createView(mLinearLayout));
- }
- }
-
- public int numItemsInOneScreenful() {
- return mNumItemsInOneScreenful;
- }
-
- @Override
- public void setLayoutTransition(LayoutTransition transition) {
- // The layout transition applies to our embedded LinearLayout
- mLinearLayout.setLayoutTransition(transition);
- }
-
- public void setCallback(RecentsCallback callback) {
- mCallback = callback;
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/TaskDescription.java b/packages/SystemUI/src/com/android/systemui/recent/TaskDescription.java
deleted file mode 100644
index 5ad965f..0000000
--- a/packages/SystemUI/src/com/android/systemui/recent/TaskDescription.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.recent;
-
-import android.os.UserHandle;
-import android.content.Intent;
-import android.content.pm.ResolveInfo;
-import android.graphics.drawable.Drawable;
-
-public final class TaskDescription {
- final ResolveInfo resolveInfo;
- final int taskId; // application task id for curating apps
- final int persistentTaskId; // persistent id
- final Intent intent; // launch intent for application
- final String packageName; // used to override animations (see onClick())
- final CharSequence description;
- final int userId;
-
- private Drawable mThumbnail; // generated by Activity.onCreateThumbnail()
- private Drawable mIcon; // application package icon
- private CharSequence mLabel; // application package label
- private boolean mLoaded;
-
- public TaskDescription(int _taskId, int _persistentTaskId,
- ResolveInfo _resolveInfo, Intent _intent,
- String _packageName, CharSequence _description, int _userId) {
- resolveInfo = _resolveInfo;
- intent = _intent;
- taskId = _taskId;
- persistentTaskId = _persistentTaskId;
-
- description = _description;
- packageName = _packageName;
- userId = _userId;
- }
-
- public TaskDescription() {
- resolveInfo = null;
- intent = null;
- taskId = -1;
- persistentTaskId = -1;
-
- description = null;
- packageName = null;
- userId = UserHandle.USER_NULL;
- }
-
- public void setLoaded(boolean loaded) {
- mLoaded = loaded;
- }
-
- public boolean isLoaded() {
- return mLoaded;
- }
-
- public boolean isNull() {
- return resolveInfo == null;
- }
-
- // mark all these as locked?
- public CharSequence getLabel() {
- return mLabel;
- }
-
- public void setLabel(CharSequence label) {
- mLabel = label;
- }
-
- public Drawable getIcon() {
- return mIcon;
- }
-
- public void setIcon(Drawable icon) {
- mIcon = icon;
- }
-
- public void setThumbnail(Drawable thumbnail) {
- mThumbnail = thumbnail;
- }
-
- public Drawable getThumbnail() {
- return mThumbnail;
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
similarity index 93%
rename from packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
rename to packages/SystemUI/src/com/android/systemui/recents/Recents.java
index 10618e0..7d7766b 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
@@ -37,10 +37,12 @@
import android.os.SystemClock;
import android.os.UserHandle;
import android.util.Pair;
+import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import com.android.systemui.R;
import com.android.systemui.RecentsComponent;
+import com.android.systemui.SystemUI;
import com.android.systemui.recents.misc.Console;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.model.RecentsTaskLoadPlan;
@@ -69,7 +71,8 @@
@interface ProxyFromAnyToPrimaryUser {}
/** A proxy implementation for the recents component */
-public class AlternateRecentsComponent implements ActivityOptions.OnAnimationStartedListener {
+public class Recents extends SystemUI
+ implements ActivityOptions.OnAnimationStartedListener, RecentsComponent {
final public static String EXTRA_TRIGGERED_FROM_ALT_TAB = "triggeredFromAltTab";
final public static String EXTRA_TRIGGERED_FROM_HOME_KEY = "triggeredFromHomeKey";
@@ -149,8 +152,8 @@
static RecentsComponent.Callbacks sRecentsComponentCallbacks;
static RecentsTaskLoadPlan sInstanceLoadPlan;
+ static Recents sInstance;
- Context mContext;
LayoutInflater mInflater;
SystemServicesProxy mSystemServicesProxy;
Handler mHandler;
@@ -178,28 +181,22 @@
boolean mTriggeredFromAltTab;
long mLastToggleTime;
- public AlternateRecentsComponent(Context context) {
- RecentsTaskLoader.initialize(context);
- mInflater = LayoutInflater.from(context);
- mContext = context;
- mSystemServicesProxy = new SystemServicesProxy(context);
- mHandler = new Handler();
- mTaskStackBounds = new Rect();
+ public Recents() {
+ }
- // Register the task stack listener
- mTaskStackListener = new TaskStackListenerImpl(mHandler);
- mSystemServicesProxy.registerTaskStackListener(mTaskStackListener);
-
- // Only the owner has the callback to update the SysUI visibility flags, so all non-owner
- // instances of AlternateRecentsComponent needs to notify the owner when the visibility
- // changes.
- if (mSystemServicesProxy.isForegroundUserOwner()) {
- mProxyBroadcastReceiver = new RecentsOwnerEventProxyReceiver();
- IntentFilter filter = new IntentFilter();
- filter.addAction(AlternateRecentsComponent.ACTION_PROXY_NOTIFY_RECENTS_VISIBLITY_TO_OWNER);
- mContext.registerReceiverAsUser(mProxyBroadcastReceiver, UserHandle.CURRENT, filter,
- null, mHandler);
+ /**
+ * Gets the singleton instance and starts it if needed. On the primary user on the device, this
+ * component gets started as a normal {@link SystemUI} component. On a secondary user, this
+ * lifecycle doesn't exist, so we need to start it manually here if needed.
+ */
+ public static Recents getInstanceAndStartIfNeeded(Context ctx) {
+ if (sInstance == null) {
+ sInstance = new Recents();
+ sInstance.mContext = ctx;
+ sInstance.start();
+ sInstance.onBootCompleted();
}
+ return sInstance;
}
/** Creates a new broadcast intent */
@@ -213,7 +210,32 @@
/** Initializes the Recents. */
@ProxyFromPrimaryToCurrentUser
- public void onStart() {
+ @Override
+ public void start() {
+ if (sInstance == null) {
+ sInstance = this;
+ }
+ RecentsTaskLoader.initialize(mContext);
+ mInflater = LayoutInflater.from(mContext);
+ mSystemServicesProxy = new SystemServicesProxy(mContext);
+ mHandler = new Handler();
+ mTaskStackBounds = new Rect();
+
+ // Register the task stack listener
+ mTaskStackListener = new TaskStackListenerImpl(mHandler);
+ mSystemServicesProxy.registerTaskStackListener(mTaskStackListener);
+
+ // Only the owner has the callback to update the SysUI visibility flags, so all non-owner
+ // instances of AlternateRecentsComponent needs to notify the owner when the visibility
+ // changes.
+ if (mSystemServicesProxy.isForegroundUserOwner()) {
+ mProxyBroadcastReceiver = new RecentsOwnerEventProxyReceiver();
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(Recents.ACTION_PROXY_NOTIFY_RECENTS_VISIBLITY_TO_OWNER);
+ mContext.registerReceiverAsUser(mProxyBroadcastReceiver, UserHandle.CURRENT, filter,
+ null, mHandler);
+ }
+
// Initialize some static datastructures
TaskStackViewLayoutAlgorithm.initializeCurve();
// Load the header bar layout
@@ -229,17 +251,20 @@
launchOpts.numVisibleTaskThumbnails = loader.getThumbnailCacheSize();
launchOpts.onlyLoadForCache = true;
loader.loadTasks(mContext, plan, launchOpts);
+ putComponent(Recents.class, this);
}
+ @Override
public void onBootCompleted() {
mBootCompleted = true;
}
/** Shows the Recents. */
@ProxyFromPrimaryToCurrentUser
- public void onShowRecents(boolean triggeredFromAltTab) {
+ @Override
+ public void showRecents(boolean triggeredFromAltTab, View statusBarView) {
if (mSystemServicesProxy.isForegroundUserOwner()) {
- showRecents(triggeredFromAltTab);
+ showRecentsInternal(triggeredFromAltTab);
} else {
Intent intent = createLocalBroadcastIntent(mContext,
RecentsUserEventProxyReceiver.ACTION_PROXY_SHOW_RECENTS_TO_USER);
@@ -247,7 +272,8 @@
mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT);
}
}
- void showRecents(boolean triggeredFromAltTab) {
+
+ void showRecentsInternal(boolean triggeredFromAltTab) {
mTriggeredFromAltTab = triggeredFromAltTab;
try {
@@ -259,9 +285,10 @@
/** Hides the Recents. */
@ProxyFromPrimaryToCurrentUser
- public void onHideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
+ @Override
+ public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
if (mSystemServicesProxy.isForegroundUserOwner()) {
- hideRecents(triggeredFromAltTab, triggeredFromHomeKey);
+ hideRecentsInternal(triggeredFromAltTab, triggeredFromHomeKey);
} else {
Intent intent = createLocalBroadcastIntent(mContext,
RecentsUserEventProxyReceiver.ACTION_PROXY_HIDE_RECENTS_TO_USER);
@@ -270,7 +297,8 @@
mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT);
}
}
- void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
+
+ void hideRecentsInternal(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
if (mBootCompleted) {
ActivityManager.RunningTaskInfo topTask = getTopMostTask();
if (topTask != null && isRecentsTopMost(topTask, null)) {
@@ -285,16 +313,18 @@
/** Toggles the Recents activity. */
@ProxyFromPrimaryToCurrentUser
- public void onToggleRecents() {
+ @Override
+ public void toggleRecents(Display display, int layoutDirection, View statusBarView) {
if (mSystemServicesProxy.isForegroundUserOwner()) {
- toggleRecents();
+ toggleRecentsInternal();
} else {
Intent intent = createLocalBroadcastIntent(mContext,
RecentsUserEventProxyReceiver.ACTION_PROXY_TOGGLE_RECENTS_TO_USER);
mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT);
}
}
- void toggleRecents() {
+
+ void toggleRecentsInternal() {
mTriggeredFromAltTab = false;
try {
@@ -306,16 +336,18 @@
/** Preloads info for the Recents activity. */
@ProxyFromPrimaryToCurrentUser
- public void onPreloadRecents() {
+ @Override
+ public void preloadRecents() {
if (mSystemServicesProxy.isForegroundUserOwner()) {
- preloadRecents();
+ preloadRecentsInternal();
} else {
Intent intent = createLocalBroadcastIntent(mContext,
RecentsUserEventProxyReceiver.ACTION_PROXY_PRELOAD_RECENTS_TO_USER);
mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT);
}
}
- void preloadRecents() {
+
+ void preloadRecentsInternal() {
// Preload only the raw task list into a new load plan (which will be consumed by the
// RecentsActivity)
RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
@@ -323,7 +355,8 @@
sInstanceLoadPlan.preloadRawTasks(true);
}
- public void onCancelPreloadingRecents() {
+ @Override
+ public void cancelPreloadingRecents() {
// Do nothing
}
@@ -398,11 +431,13 @@
}
}
- public void onShowNextAffiliatedTask() {
+ @Override
+ public void showNextAffiliatedTask() {
showRelativeAffiliatedTask(true);
}
- public void onShowPrevAffiliatedTask() {
+ @Override
+ public void showPrevAffiliatedTask() {
showRelativeAffiliatedTask(false);
}
@@ -745,7 +780,8 @@
}
/** Sets the RecentsComponent callbacks. */
- public void setRecentsComponentCallback(RecentsComponent.Callbacks cb) {
+ @Override
+ public void setCallback(RecentsComponent.Callbacks cb) {
sRecentsComponentCallbacks = cb;
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index ee631f5..95f2b7d 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -130,20 +130,20 @@
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
- if (action.equals(AlternateRecentsComponent.ACTION_HIDE_RECENTS_ACTIVITY)) {
- if (intent.getBooleanExtra(AlternateRecentsComponent.EXTRA_TRIGGERED_FROM_ALT_TAB, false)) {
+ if (action.equals(Recents.ACTION_HIDE_RECENTS_ACTIVITY)) {
+ if (intent.getBooleanExtra(Recents.EXTRA_TRIGGERED_FROM_ALT_TAB, false)) {
// If we are hiding from releasing Alt-Tab, dismiss Recents to the focused app
dismissRecentsToFocusedTaskOrHome(false);
- } else if (intent.getBooleanExtra(AlternateRecentsComponent.EXTRA_TRIGGERED_FROM_HOME_KEY, false)) {
+ } else if (intent.getBooleanExtra(Recents.EXTRA_TRIGGERED_FROM_HOME_KEY, false)) {
// Otherwise, dismiss Recents to Home
dismissRecentsToHome(true);
} else {
// Do nothing, another activity is being launched on top of Recents
}
- } else if (action.equals(AlternateRecentsComponent.ACTION_TOGGLE_RECENTS_ACTIVITY)) {
+ } else if (action.equals(Recents.ACTION_TOGGLE_RECENTS_ACTIVITY)) {
// If we are toggling Recents, then first unfilter any filtered stacks first
dismissRecentsToFocusedTaskOrHome(true);
- } else if (action.equals(AlternateRecentsComponent.ACTION_START_ENTER_ANIMATION)) {
+ } else if (action.equals(Recents.ACTION_START_ENTER_ANIMATION)) {
// Trigger the enter animation
onEnterAnimationTriggered();
// Notify the fallback receiver that we have successfully got the broadcast
@@ -185,7 +185,7 @@
// If AlternateRecentsComponent has preloaded a load plan, then use that to prevent
// reconstructing the task stack
RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
- RecentsTaskLoadPlan plan = AlternateRecentsComponent.consumeInstanceLoadPlan();
+ RecentsTaskLoadPlan plan = Recents.consumeInstanceLoadPlan();
if (plan == null) {
plan = loader.createLoadPlan(this);
}
@@ -436,13 +436,13 @@
mVisible = true;
RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
SystemServicesProxy ssp = loader.getSystemServicesProxy();
- AlternateRecentsComponent.notifyVisibilityChanged(this, ssp, true);
+ Recents.notifyVisibilityChanged(this, ssp, true);
// Register the broadcast receiver to handle messages from our service
IntentFilter filter = new IntentFilter();
- filter.addAction(AlternateRecentsComponent.ACTION_HIDE_RECENTS_ACTIVITY);
- filter.addAction(AlternateRecentsComponent.ACTION_TOGGLE_RECENTS_ACTIVITY);
- filter.addAction(AlternateRecentsComponent.ACTION_START_ENTER_ANIMATION);
+ filter.addAction(Recents.ACTION_HIDE_RECENTS_ACTIVITY);
+ filter.addAction(Recents.ACTION_TOGGLE_RECENTS_ACTIVITY);
+ filter.addAction(Recents.ACTION_START_ENTER_ANIMATION);
registerReceiver(mServiceBroadcastReceiver, filter);
// Register any broadcast receivers for the task loader
@@ -458,7 +458,7 @@
mVisible = false;
RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
SystemServicesProxy ssp = loader.getSystemServicesProxy();
- AlternateRecentsComponent.notifyVisibilityChanged(this, ssp, false);
+ Recents.notifyVisibilityChanged(this, ssp, false);
// Notify the views that we are no longer visible
mRecentsView.onRecentsHidden();
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsUserEventProxyReceiver.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsUserEventProxyReceiver.java
index 236da5db..5eefbc7 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsUserEventProxyReceiver.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsUserEventProxyReceiver.java
@@ -19,8 +19,6 @@
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
-import com.android.systemui.recent.Recents;
-
/**
* A proxy for Recents events which happens strictly for non-owner users.
@@ -39,28 +37,27 @@
@Override
public void onReceive(Context context, Intent intent) {
- AlternateRecentsComponent recents = Recents.getRecentsComponent(
- context.getApplicationContext(), true);
+ Recents recents = Recents.getInstanceAndStartIfNeeded(context);
switch (intent.getAction()) {
case ACTION_PROXY_SHOW_RECENTS_TO_USER: {
boolean triggeredFromAltTab = intent.getBooleanExtra(
- AlternateRecentsComponent.EXTRA_TRIGGERED_FROM_ALT_TAB, false);
- recents.showRecents(triggeredFromAltTab);
+ Recents.EXTRA_TRIGGERED_FROM_ALT_TAB, false);
+ recents.showRecentsInternal(triggeredFromAltTab);
break;
}
case ACTION_PROXY_HIDE_RECENTS_TO_USER: {
boolean triggeredFromAltTab = intent.getBooleanExtra(
- AlternateRecentsComponent.EXTRA_TRIGGERED_FROM_ALT_TAB, false);
+ Recents.EXTRA_TRIGGERED_FROM_ALT_TAB, false);
boolean triggeredFromHome = intent.getBooleanExtra(
- AlternateRecentsComponent.EXTRA_TRIGGERED_FROM_HOME_KEY, false);
- recents.hideRecents(triggeredFromAltTab, triggeredFromHome);
+ Recents.EXTRA_TRIGGERED_FROM_HOME_KEY, false);
+ recents.hideRecentsInternal(triggeredFromAltTab, triggeredFromHome);
break;
}
case ACTION_PROXY_TOGGLE_RECENTS_TO_USER:
- recents.toggleRecents();
+ recents.toggleRecentsInternal();
break;
case ACTION_PROXY_PRELOAD_RECENTS_TO_USER:
- recents.preloadRecents();
+ recents.preloadRecentsInternal();
break;
case ACTION_PROXY_CONFIG_CHANGE_TO_USER:
recents.configurationChanged();
diff --git a/packages/SystemUI/src/com/android/systemui/recent/ScreenPinningRequest.java b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java
similarity index 98%
rename from packages/SystemUI/src/com/android/systemui/recent/ScreenPinningRequest.java
rename to packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java
index 2fa0b58..502862e 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/ScreenPinningRequest.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.systemui.recent;
+package com.android.systemui.recents;
import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
@@ -41,7 +41,6 @@
import android.widget.TextView;
import com.android.systemui.R;
-import com.android.systemui.recents.model.RecentsTaskLoader;
import java.util.ArrayList;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 2b6ac26..21d70ba 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -91,6 +91,7 @@
import com.android.systemui.SearchPanelView;
import com.android.systemui.SwipeHelper;
import com.android.systemui.SystemUI;
+import com.android.systemui.recents.Recents;
import com.android.systemui.statusbar.NotificationData.Entry;
import com.android.systemui.statusbar.phone.NavigationBarView;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
@@ -531,7 +532,7 @@
mBarService = IStatusBarService.Stub.asInterface(
ServiceManager.getService(Context.STATUS_BAR_SERVICE));
- mRecents = getComponent(RecentsComponent.class);
+ mRecents = getComponent(Recents.class);
mRecents.setCallback(this);
final Configuration currentConfig = mContext.getResources().getConfiguration();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java
index 6cb5bcc..44168bc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java
@@ -90,24 +90,12 @@
: 0;
updateSlot("alarm_clock", null, iconId);
}
- String sync = args.getString("sync");
- if (sync != null) {
- int iconId = sync.equals("show") ? R.drawable.stat_sys_sync
- : 0;
- updateSlot("sync_active", null, iconId);
- }
String tty = args.getString("tty");
if (tty != null) {
int iconId = tty.equals("show") ? R.drawable.stat_sys_tty_mode
: 0;
updateSlot("tty", null, iconId);
}
- String eri = args.getString("eri");
- if (eri != null) {
- int iconId = eri.equals("show") ? R.drawable.stat_sys_roaming_cdma_0
- : 0;
- updateSlot("cdma_eri", null, iconId);
- }
String mute = args.getString("mute");
if (mute != null) {
int iconId = mute.equals("show") ? android.R.drawable.stat_notify_call_mute
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
index 3292f9b..34400c4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
@@ -24,10 +24,9 @@
import android.view.ViewGroup;
import com.android.internal.widget.LockPatternUtils;
-import com.android.keyguard.KeyguardViewBase;
+import com.android.keyguard.KeyguardHostView;
import com.android.keyguard.R;
import com.android.keyguard.ViewMediatorCallback;
-import com.android.systemui.keyguard.KeyguardViewMediator;
import static com.android.keyguard.KeyguardHostView.OnDismissAction;
import static com.android.keyguard.KeyguardSecurityModel.SecurityMode;
@@ -42,7 +41,7 @@
private LockPatternUtils mLockPatternUtils;
private ViewGroup mContainer;
private StatusBarWindowManager mWindowManager;
- private KeyguardViewBase mKeyguardView;
+ private KeyguardHostView mKeyguardView;
private ViewGroup mRoot;
private boolean mShowingSoon;
private Choreographer mChoreographer = Choreographer.getInstance();
@@ -138,16 +137,6 @@
}
}
- public long getUserActivityTimeout() {
- if (mKeyguardView != null) {
- long timeout = mKeyguardView.getUserActivityTimeout();
- if (timeout >= 0) {
- return timeout;
- }
- }
- return KeyguardViewMediator.AWAKE_INTERVAL_DEFAULT_MS;
- }
-
public boolean isShowing() {
return mShowingSoon || (mRoot != null && mRoot.getVisibility() == View.VISIBLE);
}
@@ -169,7 +158,7 @@
private void inflateView() {
removeView();
mRoot = (ViewGroup) LayoutInflater.from(mContext).inflate(R.layout.keyguard_bouncer, null);
- mKeyguardView = (KeyguardViewBase) mRoot.findViewById(R.id.keyguard_host_view);
+ mKeyguardView = (KeyguardHostView) mRoot.findViewById(R.id.keyguard_host_view);
mKeyguardView.setLockPatternUtils(mLockPatternUtils);
mKeyguardView.setViewMediatorCallback(mCallback);
mContainer.addView(mRoot, mContainer.getChildCount());
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index d6647af..5bff79a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -128,7 +128,7 @@
import com.android.systemui.doze.DozeLog;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.qs.QSPanel;
-import com.android.systemui.recent.ScreenPinningRequest;
+import com.android.systemui.recents.ScreenPinningRequest;
import com.android.systemui.statusbar.ActivatableNotificationView;
import com.android.systemui.statusbar.BackDropView;
import com.android.systemui.statusbar.BaseStatusBar;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index 5c254a26..e8a000c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -46,16 +46,12 @@
private static final String TAG = "PhoneStatusBarPolicy";
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
- private static final boolean SHOW_SYNC_ICON = false;
-
- private static final String SLOT_SYNC_ACTIVE = "sync_active";
private static final String SLOT_CAST = "cast";
private static final String SLOT_HOTSPOT = "hotspot";
private static final String SLOT_BLUETOOTH = "bluetooth";
private static final String SLOT_TTY = "tty";
private static final String SLOT_ZEN = "zen";
private static final String SLOT_VOLUME = "volume";
- private static final String SLOT_CDMA_ERI = "cdma_eri";
private static final String SLOT_ALARM_CLOCK = "alarm_clock";
private final Context mContext;
@@ -83,9 +79,6 @@
if (action.equals(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED)) {
updateAlarm();
}
- else if (action.equals(Intent.ACTION_SYNC_STATE_CHANGED)) {
- updateSyncState(intent);
- }
else if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED) ||
action.equals(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED)) {
updateBluetooth();
@@ -115,7 +108,6 @@
// listen for broadcasts
IntentFilter filter = new IntentFilter();
filter.addAction(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED);
- filter.addAction(Intent.ACTION_SYNC_STATE_CHANGED);
filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
filter.addAction(AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION);
filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
@@ -129,10 +121,6 @@
mService.setIcon(SLOT_TTY, R.drawable.stat_sys_tty_mode, 0, null);
mService.setIconVisibility(SLOT_TTY, false);
- // Cdma Roaming Indicator, ERI
- mService.setIcon(SLOT_CDMA_ERI, R.drawable.stat_sys_roaming_cdma_0, 0, null);
- mService.setIconVisibility(SLOT_CDMA_ERI, false);
-
// bluetooth status
updateBluetooth();
@@ -140,11 +128,6 @@
mService.setIcon(SLOT_ALARM_CLOCK, R.drawable.stat_sys_alarm, 0, null);
mService.setIconVisibility(SLOT_ALARM_CLOCK, false);
- // Sync state
- mService.setIcon(SLOT_SYNC_ACTIVE, R.drawable.stat_sys_sync, 0, null);
- mService.setIconVisibility(SLOT_SYNC_ACTIVE, false);
- // "sync_failing" is obsolete: b/1297963
-
// zen
mService.setIcon(SLOT_ZEN, R.drawable.stat_sys_zen_important, 0, null);
mService.setIconVisibility(SLOT_ZEN, false);
@@ -172,16 +155,10 @@
private void updateAlarm() {
AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
- boolean alarmSet = alarmManager.getNextAlarmClock(UserHandle.USER_CURRENT) != null;
+ boolean alarmSet = alarmManager.getNextAlarmClock(UserHandle.USER_CURRENT) != null;
mService.setIconVisibility(SLOT_ALARM_CLOCK, alarmSet);
}
- private final void updateSyncState(Intent intent) {
- if (!SHOW_SYNC_ICON) return;
- boolean isActive = intent.getBooleanExtra("active", false);
- mService.setIconVisibility(SLOT_SYNC_ACTIVE, isActive);
- }
-
private final void updateSimState(Intent intent) {
String stateExtra = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE);
if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(stateExtra)) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index f4edab5..3155efb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -187,10 +187,6 @@
mStatusBarWindowManager.setKeyguardNeedsInput(needsInput);
}
- public void updateUserActivityTimeout() {
- mStatusBarWindowManager.setKeyguardUserActivityTimeout(mBouncer.getUserActivityTimeout());
- }
-
public void setOccluded(boolean occluded) {
if (occluded && !mOccluded && mShowing) {
if (mPhoneStatusBar.isInLaunchTransition()) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
index 0dbdca1..eba7d9f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
@@ -27,6 +27,7 @@
import android.view.WindowManager;
import com.android.keyguard.R;
+import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.StatusBarState;
@@ -144,7 +145,7 @@
if (state.isKeyguardShowingAndNotOccluded()
&& state.statusBarState == StatusBarState.KEYGUARD
&& !state.qsExpanded) {
- mLpChanged.userActivityTimeout = state.keyguardUserActivityTimeout;
+ mLpChanged.userActivityTimeout = KeyguardViewMediator.AWAKE_INTERVAL_DEFAULT_MS;
} else {
mLpChanged.userActivityTimeout = -1;
}
@@ -201,11 +202,6 @@
apply(mCurrentState);
}
- public void setKeyguardUserActivityTimeout(long timeout) {
- mCurrentState.keyguardUserActivityTimeout = timeout;
- apply(mCurrentState);
- }
-
public void setBouncerShowing(boolean showing) {
mCurrentState.bouncerShowing = showing;
apply(mCurrentState);
@@ -235,7 +231,6 @@
boolean keyguardNeedsInput;
boolean statusBarExpanded;
boolean statusBarFocusable;
- long keyguardUserActivityTimeout;
boolean bouncerShowing;
boolean keyguardFadingAway;
boolean qsExpanded;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
new file mode 100644
index 0000000..45b1e24
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -0,0 +1,545 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.systemui.statusbar.policy;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.NetworkCapabilities;
+import android.telephony.PhoneStateListener;
+import android.telephony.ServiceState;
+import android.telephony.SignalStrength;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+import android.util.Log;
+import android.util.SparseArray;
+
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.telephony.IccCardConstants;
+import com.android.internal.telephony.TelephonyIntents;
+import com.android.internal.telephony.cdma.EriInfo;
+import com.android.systemui.R;
+import com.android.systemui.statusbar.policy.NetworkController.NetworkSignalChangedCallback;
+import com.android.systemui.statusbar.policy.NetworkControllerImpl.Config;
+import com.android.systemui.statusbar.policy.NetworkControllerImpl.SignalCluster;
+
+import java.io.PrintWriter;
+import java.util.List;
+import java.util.Objects;
+
+
+public class MobileSignalController extends SignalController<
+ MobileSignalController.MobileState, MobileSignalController.MobileIconGroup> {
+ private final TelephonyManager mPhone;
+ private final String mNetworkNameDefault;
+ private final String mNetworkNameSeparator;
+ @VisibleForTesting
+ final PhoneStateListener mPhoneStateListener;
+ // Save entire info for logging, we only use the id.
+ private final SubscriptionInfo mSubscriptionInfo;
+
+ // @VisibleForDemoMode
+ final SparseArray<MobileIconGroup> mNetworkToIconLookup;
+
+ // Since some pieces of the phone state are interdependent we store it locally,
+ // this could potentially become part of MobileState for simplification/complication
+ // of code.
+ private IccCardConstants.State mSimState = IccCardConstants.State.READY;
+ private int mDataNetType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
+ private int mDataState = TelephonyManager.DATA_DISCONNECTED;
+ private ServiceState mServiceState;
+ private SignalStrength mSignalStrength;
+ private MobileIconGroup mDefaultIcons;
+ private Config mConfig;
+
+ // TODO: Reduce number of vars passed in, if we have the NetworkController, probably don't
+ // need listener lists anymore.
+ public MobileSignalController(Context context, Config config, boolean hasMobileData,
+ TelephonyManager phone, List<NetworkSignalChangedCallback> signalCallbacks,
+ List<SignalCluster> signalClusters, NetworkControllerImpl networkController,
+ SubscriptionInfo info) {
+ super("MobileSignalController(" + info.getSubscriptionId() + ")", context,
+ NetworkCapabilities.TRANSPORT_CELLULAR, signalCallbacks, signalClusters,
+ networkController);
+ mNetworkToIconLookup = new SparseArray<>();
+ mConfig = config;
+ mPhone = phone;
+ mSubscriptionInfo = info;
+ mPhoneStateListener = new MobilePhoneStateListener(info.getSubscriptionId());
+ mNetworkNameSeparator = getStringIfExists(R.string.status_bar_network_name_separator);
+ mNetworkNameDefault = getStringIfExists(
+ com.android.internal.R.string.lockscreen_carrier_default);
+
+ mapIconSets();
+
+ mLastState.networkName = mCurrentState.networkName = mNetworkNameDefault;
+ mLastState.enabled = mCurrentState.enabled = hasMobileData;
+ mLastState.iconGroup = mCurrentState.iconGroup = mDefaultIcons;
+ // Get initial data sim state.
+ updateDataSim();
+ }
+
+ public void setConfiguration(Config config) {
+ mConfig = config;
+ mapIconSets();
+ updateTelephony();
+ }
+
+ /**
+ * Get (the mobile parts of) the carrier string.
+ *
+ * @param currentLabel can be used for concatenation, currently just empty
+ * @param connected whether the device has connection to the internet at all
+ * @param isMobileLabel whether to always return the network or just when data is connected
+ */
+ public String getLabel(String currentLabel, boolean connected, boolean isMobileLabel) {
+ if (!mCurrentState.enabled) {
+ return "";
+ } else {
+ String mobileLabel = "";
+ // We want to show the carrier name if in service and either:
+ // - We are connected to mobile data, or
+ // - We are not connected to mobile data, as long as the *reason* packets are not
+ // being routed over that link is that we have better connectivity via wifi.
+ // If data is disconnected for some other reason but wifi (or ethernet/bluetooth)
+ // is connected, we show nothing.
+ // Otherwise (nothing connected) we show "No internet connection".
+ if (mCurrentState.dataConnected) {
+ mobileLabel = mCurrentState.networkName;
+ } else if (connected || mCurrentState.isEmergency) {
+ if (mCurrentState.connected || mCurrentState.isEmergency) {
+ // The isEmergencyOnly test covers the case of a phone with no SIM
+ mobileLabel = mCurrentState.networkName;
+ }
+ } else {
+ mobileLabel = mContext.getString(
+ R.string.status_bar_settings_signal_meter_disconnected);
+ }
+
+ if (currentLabel.length() != 0) {
+ currentLabel = currentLabel + mNetworkNameSeparator;
+ }
+ // Now for things that should only be shown when actually using mobile data.
+ if (isMobileLabel) {
+ return currentLabel + mobileLabel;
+ } else {
+ return currentLabel
+ + (mCurrentState.dataConnected ? mobileLabel : currentLabel);
+ }
+ }
+ }
+
+ public int getDataContentDescription() {
+ return getIcons().mDataContentDescription;
+ }
+
+ @VisibleForTesting
+ protected IccCardConstants.State getSimState() {
+ return mSimState;
+ }
+
+ public void setAirplaneMode(boolean airplaneMode) {
+ mCurrentState.airplaneMode = airplaneMode;
+ notifyListenersIfNecessary();
+ }
+
+ public void setInetCondition(int inetCondition, int inetConditionForNetwork) {
+ // For mobile data, use general inet condition for phone signal indexing,
+ // and network specific for data indexing (I think this might be a bug, but
+ // keeping for now).
+ // TODO: Update with explanation of why.
+ mCurrentState.inetForNetwork = inetConditionForNetwork;
+ setInetCondition(inetCondition);
+ }
+
+ /**
+ * Start listening for phone state changes.
+ */
+ public void registerListener() {
+ mPhone.listen(mPhoneStateListener,
+ PhoneStateListener.LISTEN_SERVICE_STATE
+ | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
+ | PhoneStateListener.LISTEN_CALL_STATE
+ | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
+ | PhoneStateListener.LISTEN_DATA_ACTIVITY);
+ }
+
+ /**
+ * Stop listening for phone state changes.
+ */
+ public void unregisterListener() {
+ mPhone.listen(mPhoneStateListener, 0);
+ }
+
+ /**
+ * Produce a mapping of data network types to icon groups for simple and quick use in
+ * updateTelephony.
+ */
+ private void mapIconSets() {
+ mNetworkToIconLookup.clear();
+
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_EVDO_0, TelephonyIcons.THREE_G);
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_EVDO_A, TelephonyIcons.THREE_G);
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_EVDO_B, TelephonyIcons.THREE_G);
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_EHRPD, TelephonyIcons.THREE_G);
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_UMTS, TelephonyIcons.THREE_G);
+
+ if (!mConfig.showAtLeast3G) {
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_UNKNOWN,
+ TelephonyIcons.UNKNOWN);
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_EDGE, TelephonyIcons.E);
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_CDMA, TelephonyIcons.ONE_X);
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_1xRTT, TelephonyIcons.ONE_X);
+
+ mDefaultIcons = TelephonyIcons.G;
+ } else {
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_UNKNOWN,
+ TelephonyIcons.THREE_G);
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_EDGE,
+ TelephonyIcons.THREE_G);
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_CDMA,
+ TelephonyIcons.THREE_G);
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_1xRTT,
+ TelephonyIcons.THREE_G);
+ mDefaultIcons = TelephonyIcons.THREE_G;
+ }
+
+ MobileIconGroup hGroup = TelephonyIcons.THREE_G;
+ if (mConfig.hspaDataDistinguishable) {
+ hGroup = TelephonyIcons.H;
+ }
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_HSDPA, hGroup);
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_HSUPA, hGroup);
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_HSPA, hGroup);
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_HSPAP, hGroup);
+
+ if (mConfig.show4gForLte) {
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_LTE, TelephonyIcons.FOUR_G);
+ } else {
+ mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_LTE, TelephonyIcons.LTE);
+ }
+ }
+
+ @Override
+ public void notifyListeners() {
+ MobileIconGroup icons = getIcons();
+
+ String contentDescription = getStringIfExists(getContentDescription());
+ String dataContentDescription = getStringIfExists(icons.mDataContentDescription);
+ // Only send data sim callbacks to QS.
+ if (mCurrentState.dataSim) {
+ int qsTypeIcon = mCurrentState.dataConnected ?
+ icons.mQsDataType[mCurrentState.inetForNetwork] : 0;
+ int length = mSignalsChangedCallbacks.size();
+ for (int i = 0; i < length; i++) {
+ mSignalsChangedCallbacks.get(i).onMobileDataSignalChanged(mCurrentState.enabled
+ && !mCurrentState.isEmergency && !mCurrentState.airplaneMode,
+ getQsCurrentIconId(), contentDescription,
+ qsTypeIcon,
+ mCurrentState.dataConnected && mCurrentState.activityIn,
+ mCurrentState.dataConnected && mCurrentState.activityOut,
+ dataContentDescription,
+ mCurrentState.isEmergency ? null : mCurrentState.networkName,
+ // Only wide if actually showing something.
+ icons.mIsWide && qsTypeIcon != 0);
+ }
+ }
+ boolean showDataIcon = mCurrentState.dataConnected && mCurrentState.inetForNetwork != 0
+ || mCurrentState.iconGroup == TelephonyIcons.ROAMING;
+ int typeIcon = showDataIcon ? icons.mDataType : 0;
+ int signalClustersLength = mSignalClusters.size();
+ for (int i = 0; i < signalClustersLength; i++) {
+ mSignalClusters.get(i).setMobileDataIndicators(
+ mCurrentState.enabled && !mCurrentState.airplaneMode,
+ getCurrentIconId(),
+ typeIcon,
+ contentDescription,
+ dataContentDescription,
+ // Only wide if actually showing something.
+ icons.mIsWide && typeIcon != 0,
+ mSubscriptionInfo.getSubscriptionId());
+ }
+ }
+
+ @Override
+ protected MobileState cleanState() {
+ return new MobileState();
+ }
+
+ private boolean hasService() {
+ if (mServiceState != null) {
+ // Consider the device to be in service if either voice or data
+ // service is available. Some SIM cards are marketed as data-only
+ // and do not support voice service, and on these SIM cards, we
+ // want to show signal bars for data service as well as the "no
+ // service" or "emergency calls only" text that indicates that voice
+ // is not available.
+ switch (mServiceState.getVoiceRegState()) {
+ case ServiceState.STATE_POWER_OFF:
+ return false;
+ case ServiceState.STATE_OUT_OF_SERVICE:
+ case ServiceState.STATE_EMERGENCY_ONLY:
+ return mServiceState.getDataRegState() == ServiceState.STATE_IN_SERVICE;
+ default:
+ return true;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ private boolean isCdma() {
+ return (mSignalStrength != null) && !mSignalStrength.isGsm();
+ }
+
+ public boolean isEmergencyOnly() {
+ return (mServiceState != null && mServiceState.isEmergencyOnly());
+ }
+
+ private boolean isRoaming() {
+ if (isCdma()) {
+ final int iconMode = mServiceState.getCdmaEriIconMode();
+ return mServiceState.getCdmaEriIconIndex() != EriInfo.ROAMING_INDICATOR_OFF
+ && (iconMode == EriInfo.ROAMING_ICON_MODE_NORMAL
+ || iconMode == EriInfo.ROAMING_ICON_MODE_FLASH);
+ } else {
+ return mServiceState != null && mServiceState.getRoaming();
+ }
+ }
+
+ public void handleBroadcast(Intent intent) {
+ String action = intent.getAction();
+ if (action.equals(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION)) {
+ updateNetworkName(intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_SPN, false),
+ intent.getStringExtra(TelephonyIntents.EXTRA_SPN),
+ intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_PLMN, false),
+ intent.getStringExtra(TelephonyIntents.EXTRA_PLMN));
+ notifyListenersIfNecessary();
+ } else if (action.equals(TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED)) {
+ updateDataSim();
+ }
+ }
+
+ private void updateDataSim() {
+ int defaultDataSub = SubscriptionManager.getDefaultDataSubId();
+ if (SubscriptionManager.isValidSubscriptionId(defaultDataSub)) {
+ mCurrentState.dataSim = defaultDataSub == mSubscriptionInfo.getSubscriptionId();
+ } else {
+ // There doesn't seem to be a data sim selected, however if
+ // there isn't a MobileSignalController with dataSim set, then
+ // QS won't get any callbacks and will be blank. Instead
+ // lets just assume we are the data sim (which will basically
+ // show one at random) in QS until one is selected. The user
+ // should pick one soon after, so we shouldn't be in this state
+ // for long.
+ mCurrentState.dataSim = true;
+ }
+ notifyListenersIfNecessary();
+ }
+
+ /**
+ * Updates the network's name based on incoming spn and plmn.
+ */
+ void updateNetworkName(boolean showSpn, String spn, boolean showPlmn, String plmn) {
+ if (CHATTY) {
+ Log.d("CarrierLabel", "updateNetworkName showSpn=" + showSpn + " spn=" + spn
+ + " showPlmn=" + showPlmn + " plmn=" + plmn);
+ }
+ StringBuilder str = new StringBuilder();
+ if (showPlmn && plmn != null) {
+ str.append(plmn);
+ }
+ if (showSpn && spn != null) {
+ if (str.length() != 0) {
+ str.append(mNetworkNameSeparator);
+ }
+ str.append(spn);
+ }
+ if (str.length() != 0) {
+ mCurrentState.networkName = str.toString();
+ } else {
+ mCurrentState.networkName = mNetworkNameDefault;
+ }
+ }
+
+ /**
+ * Updates the current state based on mServiceState, mSignalStrength, mDataNetType,
+ * mDataState, and mSimState. It should be called any time one of these is updated.
+ * This will call listeners if necessary.
+ */
+ private final void updateTelephony() {
+ if (DEBUG) {
+ Log.d(mTag, "updateTelephonySignalStrength: hasService=" + hasService()
+ + " ss=" + mSignalStrength);
+ }
+ mCurrentState.connected = hasService() && mSignalStrength != null;
+ if (mCurrentState.connected) {
+ if (!mSignalStrength.isGsm() && mConfig.alwaysShowCdmaRssi) {
+ mCurrentState.level = mSignalStrength.getCdmaLevel();
+ } else {
+ mCurrentState.level = mSignalStrength.getLevel();
+ }
+ }
+ if (mNetworkToIconLookup.indexOfKey(mDataNetType) >= 0) {
+ mCurrentState.iconGroup = mNetworkToIconLookup.get(mDataNetType);
+ } else {
+ mCurrentState.iconGroup = mDefaultIcons;
+ }
+ mCurrentState.dataConnected = mCurrentState.connected
+ && mDataState == TelephonyManager.DATA_CONNECTED;
+
+ if (isRoaming()) {
+ mCurrentState.iconGroup = TelephonyIcons.ROAMING;
+ }
+ if (isEmergencyOnly() != mCurrentState.isEmergency) {
+ mCurrentState.isEmergency = isEmergencyOnly();
+ mNetworkController.recalculateEmergency();
+ }
+ // Fill in the network name if we think we have it.
+ if (mCurrentState.networkName == mNetworkNameDefault && mServiceState != null
+ && mServiceState.getOperatorAlphaShort() != null) {
+ mCurrentState.networkName = mServiceState.getOperatorAlphaShort();
+ }
+ notifyListenersIfNecessary();
+ }
+
+ @VisibleForTesting
+ void setActivity(int activity) {
+ mCurrentState.activityIn = activity == TelephonyManager.DATA_ACTIVITY_INOUT
+ || activity == TelephonyManager.DATA_ACTIVITY_IN;
+ mCurrentState.activityOut = activity == TelephonyManager.DATA_ACTIVITY_INOUT
+ || activity == TelephonyManager.DATA_ACTIVITY_OUT;
+ notifyListenersIfNecessary();
+ }
+
+ @Override
+ public void dump(PrintWriter pw) {
+ super.dump(pw);
+ pw.println(" mSubscription=" + mSubscriptionInfo + ",");
+ pw.println(" mServiceState=" + mServiceState + ",");
+ pw.println(" mSignalStrength=" + mSignalStrength + ",");
+ pw.println(" mDataState=" + mDataState + ",");
+ pw.println(" mDataNetType=" + mDataNetType + ",");
+ }
+
+ class MobilePhoneStateListener extends PhoneStateListener {
+ public MobilePhoneStateListener(int subId) {
+ super(subId);
+ }
+
+ @Override
+ public void onSignalStrengthsChanged(SignalStrength signalStrength) {
+ if (DEBUG) {
+ Log.d(mTag, "onSignalStrengthsChanged signalStrength=" + signalStrength +
+ ((signalStrength == null) ? "" : (" level=" + signalStrength.getLevel())));
+ }
+ mSignalStrength = signalStrength;
+ updateTelephony();
+ }
+
+ @Override
+ public void onServiceStateChanged(ServiceState state) {
+ if (DEBUG) {
+ Log.d(mTag, "onServiceStateChanged voiceState=" + state.getVoiceRegState()
+ + " dataState=" + state.getDataRegState());
+ }
+ mServiceState = state;
+ updateTelephony();
+ }
+
+ @Override
+ public void onDataConnectionStateChanged(int state, int networkType) {
+ if (DEBUG) {
+ Log.d(mTag, "onDataConnectionStateChanged: state=" + state
+ + " type=" + networkType);
+ }
+ mDataState = state;
+ mDataNetType = networkType;
+ updateTelephony();
+ }
+
+ @Override
+ public void onDataActivity(int direction) {
+ if (DEBUG) {
+ Log.d(mTag, "onDataActivity: direction=" + direction);
+ }
+ setActivity(direction);
+ }
+ };
+
+ static class MobileIconGroup extends SignalController.IconGroup {
+ final int mDataContentDescription; // mContentDescriptionDataType
+ final int mDataType;
+ final boolean mIsWide;
+ final int[] mQsDataType;
+
+ public MobileIconGroup(String name, int[][] sbIcons, int[][] qsIcons, int[] contentDesc,
+ int sbNullState, int qsNullState, int sbDiscState, int qsDiscState,
+ int discContentDesc, int dataContentDesc, int dataType, boolean isWide,
+ int[] qsDataType) {
+ super(name, sbIcons, qsIcons, contentDesc, sbNullState, qsNullState, sbDiscState,
+ qsDiscState, discContentDesc);
+ mDataContentDescription = dataContentDesc;
+ mDataType = dataType;
+ mIsWide = isWide;
+ mQsDataType = qsDataType;
+ }
+ }
+
+ static class MobileState extends SignalController.State {
+ String networkName;
+ boolean dataSim;
+ boolean dataConnected;
+ boolean isEmergency;
+ boolean airplaneMode;
+ int inetForNetwork;
+
+ @Override
+ public void copyFrom(State s) {
+ super.copyFrom(s);
+ MobileState state = (MobileState) s;
+ dataSim = state.dataSim;
+ networkName = state.networkName;
+ dataConnected = state.dataConnected;
+ inetForNetwork = state.inetForNetwork;
+ isEmergency = state.isEmergency;
+ airplaneMode = state.airplaneMode;
+ }
+
+ @Override
+ protected void toString(StringBuilder builder) {
+ super.toString(builder);
+ builder.append(',');
+ builder.append("dataSim=").append(dataSim).append(',');
+ builder.append("networkName=").append(networkName).append(',');
+ builder.append("dataConnected=").append(dataConnected).append(',');
+ builder.append("inetForNetwork=").append(inetForNetwork).append(',');
+ builder.append("isEmergency=").append(isEmergency).append(',');
+ builder.append("airplaneMode=").append(airplaneMode);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return super.equals(o)
+ && Objects.equals(((MobileState) o).networkName, networkName)
+ && ((MobileState) o).dataSim == dataSim
+ && ((MobileState) o).dataConnected == dataConnected
+ && ((MobileState) o).isEmergency == isEmergency
+ && ((MobileState) o).airplaneMode == airplaneMode
+ && ((MobileState) o).inetForNetwork == inetForNetwork;
+ }
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index 3642eae..5fce0cf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -18,9 +18,8 @@
import static android.net.NetworkCapabilities.NET_CAPABILITY_VALIDATED;
import static android.net.NetworkCapabilities.TRANSPORT_BLUETOOTH;
-import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
import static android.net.NetworkCapabilities.TRANSPORT_ETHERNET;
-import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
+
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -28,34 +27,20 @@
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.NetworkCapabilities;
-import android.net.NetworkInfo;
-import android.net.wifi.WifiConfiguration;
-import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.AsyncTask;
import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.os.Messenger;
import android.provider.Settings;
-import android.telephony.PhoneStateListener;
-import android.telephony.ServiceState;
-import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
-import android.text.format.DateFormat;
import android.util.Log;
-import android.util.SparseArray;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyIntents;
-import com.android.internal.telephony.cdma.EriInfo;
-import com.android.internal.util.AsyncChannel;
import com.android.systemui.DemoMode;
import com.android.systemui.R;
@@ -69,7 +54,6 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.Objects;
/** Platform implementation of the network controller. **/
public class NetworkControllerImpl extends BroadcastReceiver
@@ -79,12 +63,6 @@
static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
// additional diagnostics, but not logspew
static final boolean CHATTY = Log.isLoggable(TAG + ".Chat", Log.DEBUG);
- // Save the previous SignalController.States of all SignalControllers for dumps.
- static final boolean RECORD_HISTORY = true;
- // If RECORD_HISTORY how many to save, must be a power of 2.
- static final int HISTORY_SIZE = 16;
-
- private static final int INET_CONDITION_THRESHOLD = 50;
private final Context mContext;
private final TelephonyManager mPhone;
@@ -821,969 +799,6 @@
};
};
- // TODO: Move to its own file.
- static class WifiSignalController extends
- SignalController<WifiSignalController.WifiState, SignalController.IconGroup> {
- private final WifiManager mWifiManager;
- private final AsyncChannel mWifiChannel;
- private final boolean mHasMobileData;
-
- public WifiSignalController(Context context, boolean hasMobileData,
- List<NetworkSignalChangedCallback> signalCallbacks,
- List<SignalCluster> signalClusters, NetworkControllerImpl networkController) {
- super("WifiSignalController", context, NetworkCapabilities.TRANSPORT_WIFI,
- signalCallbacks, signalClusters, networkController);
- mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
- mHasMobileData = hasMobileData;
- Handler handler = new WifiHandler();
- mWifiChannel = new AsyncChannel();
- Messenger wifiMessenger = mWifiManager.getWifiServiceMessenger();
- if (wifiMessenger != null) {
- mWifiChannel.connect(context, handler, wifiMessenger);
- }
- // WiFi only has one state.
- mCurrentState.iconGroup = mLastState.iconGroup = new IconGroup(
- "Wi-Fi Icons",
- WifiIcons.WIFI_SIGNAL_STRENGTH,
- WifiIcons.QS_WIFI_SIGNAL_STRENGTH,
- AccessibilityContentDescriptions.WIFI_CONNECTION_STRENGTH,
- WifiIcons.WIFI_NO_NETWORK,
- WifiIcons.QS_WIFI_NO_NETWORK,
- WifiIcons.WIFI_NO_NETWORK,
- WifiIcons.QS_WIFI_NO_NETWORK,
- AccessibilityContentDescriptions.WIFI_NO_CONNECTION
- );
- }
-
- @Override
- protected WifiState cleanState() {
- return new WifiState();
- }
-
- @Override
- public void notifyListeners() {
- // only show wifi in the cluster if connected or if wifi-only
- boolean wifiVisible = mCurrentState.enabled
- && (mCurrentState.connected || !mHasMobileData);
- String wifiDesc = wifiVisible ? mCurrentState.ssid : null;
- boolean ssidPresent = wifiVisible && mCurrentState.ssid != null;
- String contentDescription = getStringIfExists(getContentDescription());
- int length = mSignalsChangedCallbacks.size();
- for (int i = 0; i < length; i++) {
- mSignalsChangedCallbacks.get(i).onWifiSignalChanged(mCurrentState.enabled,
- mCurrentState.connected, getQsCurrentIconId(),
- ssidPresent && mCurrentState.activityIn,
- ssidPresent && mCurrentState.activityOut, contentDescription, wifiDesc);
- }
-
- int signalClustersLength = mSignalClusters.size();
- for (int i = 0; i < signalClustersLength; i++) {
- mSignalClusters.get(i).setWifiIndicators(wifiVisible, getCurrentIconId(),
- contentDescription);
- }
- }
-
- /**
- * Extract wifi state directly from broadcasts about changes in wifi state.
- */
- public void handleBroadcast(Intent intent) {
- String action = intent.getAction();
- if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
- mCurrentState.enabled = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
- WifiManager.WIFI_STATE_UNKNOWN) == WifiManager.WIFI_STATE_ENABLED;
- } else if (action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
- final NetworkInfo networkInfo = (NetworkInfo)
- intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
- mCurrentState.connected = networkInfo != null && networkInfo.isConnected();
- // If Connected grab the signal strength and ssid.
- if (mCurrentState.connected) {
- // try getting it out of the intent first
- WifiInfo info = intent.getParcelableExtra(WifiManager.EXTRA_WIFI_INFO) != null
- ? (WifiInfo) intent.getParcelableExtra(WifiManager.EXTRA_WIFI_INFO)
- : mWifiManager.getConnectionInfo();
- if (info != null) {
- mCurrentState.ssid = getSsid(info);
- } else {
- mCurrentState.ssid = null;
- }
- } else if (!mCurrentState.connected) {
- mCurrentState.ssid = null;
- }
- } else if (action.equals(WifiManager.RSSI_CHANGED_ACTION)) {
- // Default to -200 as its below WifiManager.MIN_RSSI.
- mCurrentState.rssi = intent.getIntExtra(WifiManager.EXTRA_NEW_RSSI, -200);
- mCurrentState.level = WifiManager.calculateSignalLevel(
- mCurrentState.rssi, WifiIcons.WIFI_LEVEL_COUNT);
- }
-
- notifyListenersIfNecessary();
- }
-
- private String getSsid(WifiInfo info) {
- String ssid = info.getSSID();
- if (ssid != null) {
- return ssid;
- }
- // OK, it's not in the connectionInfo; we have to go hunting for it
- List<WifiConfiguration> networks = mWifiManager.getConfiguredNetworks();
- int length = networks.size();
- for (int i = 0; i < length; i++) {
- if (networks.get(i).networkId == info.getNetworkId()) {
- return networks.get(i).SSID;
- }
- }
- return null;
- }
-
- @VisibleForTesting
- void setActivity(int wifiActivity) {
- mCurrentState.activityIn = wifiActivity == WifiManager.DATA_ACTIVITY_INOUT
- || wifiActivity == WifiManager.DATA_ACTIVITY_IN;
- mCurrentState.activityOut = wifiActivity == WifiManager.DATA_ACTIVITY_INOUT
- || wifiActivity == WifiManager.DATA_ACTIVITY_OUT;
- notifyListenersIfNecessary();
- }
-
- /**
- * Handler to receive the data activity on wifi.
- */
- class WifiHandler extends Handler {
- @Override
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case AsyncChannel.CMD_CHANNEL_HALF_CONNECTED:
- if (msg.arg1 == AsyncChannel.STATUS_SUCCESSFUL) {
- mWifiChannel.sendMessage(Message.obtain(this,
- AsyncChannel.CMD_CHANNEL_FULL_CONNECTION));
- } else {
- Log.e(mTag, "Failed to connect to wifi");
- }
- break;
- case WifiManager.DATA_ACTIVITY_NOTIFICATION:
- setActivity(msg.arg1);
- break;
- default:
- // Ignore
- break;
- }
- }
- }
-
- static class WifiState extends SignalController.State {
- String ssid;
-
- @Override
- public void copyFrom(State s) {
- super.copyFrom(s);
- WifiState state = (WifiState) s;
- ssid = state.ssid;
- }
-
- @Override
- protected void toString(StringBuilder builder) {
- super.toString(builder);
- builder.append(',').append("ssid=").append(ssid);
- }
-
- @Override
- public boolean equals(Object o) {
- return super.equals(o)
- && Objects.equals(((WifiState) o).ssid, ssid);
- }
- }
- }
-
- // TODO: Move to its own file.
- public static class MobileSignalController extends SignalController<
- MobileSignalController.MobileState, MobileSignalController.MobileIconGroup> {
- private final TelephonyManager mPhone;
- private final String mNetworkNameDefault;
- private final String mNetworkNameSeparator;
- @VisibleForTesting
- final PhoneStateListener mPhoneStateListener;
- // Save entire info for logging, we only use the id.
- private final SubscriptionInfo mSubscriptionInfo;
-
- // @VisibleForDemoMode
- final SparseArray<MobileIconGroup> mNetworkToIconLookup;
-
- // Since some pieces of the phone state are interdependent we store it locally,
- // this could potentially become part of MobileState for simplification/complication
- // of code.
- private IccCardConstants.State mSimState = IccCardConstants.State.READY;
- private int mDataNetType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
- private int mDataState = TelephonyManager.DATA_DISCONNECTED;
- private ServiceState mServiceState;
- private SignalStrength mSignalStrength;
- private MobileIconGroup mDefaultIcons;
- private Config mConfig;
-
- // TODO: Reduce number of vars passed in, if we have the NetworkController, probably don't
- // need listener lists anymore.
- public MobileSignalController(Context context, Config config, boolean hasMobileData,
- TelephonyManager phone, List<NetworkSignalChangedCallback> signalCallbacks,
- List<SignalCluster> signalClusters, NetworkControllerImpl networkController,
- SubscriptionInfo info) {
- super("MobileSignalController(" + info.getSubscriptionId() + ")", context,
- NetworkCapabilities.TRANSPORT_CELLULAR, signalCallbacks, signalClusters,
- networkController);
- mNetworkToIconLookup = new SparseArray<>();
- mConfig = config;
- mPhone = phone;
- mSubscriptionInfo = info;
- mPhoneStateListener = new MobilePhoneStateListener(info.getSubscriptionId());
- mNetworkNameSeparator = getStringIfExists(R.string.status_bar_network_name_separator);
- mNetworkNameDefault = getStringIfExists(
- com.android.internal.R.string.lockscreen_carrier_default);
-
- mapIconSets();
-
- mLastState.networkName = mCurrentState.networkName = mNetworkNameDefault;
- mLastState.enabled = mCurrentState.enabled = hasMobileData;
- mLastState.iconGroup = mCurrentState.iconGroup = mDefaultIcons;
- // Get initial data sim state.
- updateDataSim();
- }
-
- public void setConfiguration(Config config) {
- mConfig = config;
- mapIconSets();
- updateTelephony();
- }
-
- /**
- * Get (the mobile parts of) the carrier string.
- *
- * @param currentLabel can be used for concatenation, currently just empty
- * @param connected whether the device has connection to the internet at all
- * @param isMobileLabel whether to always return the network or just when data is connected
- */
- public String getLabel(String currentLabel, boolean connected, boolean isMobileLabel) {
- if (!mCurrentState.enabled) {
- return "";
- } else {
- String mobileLabel = "";
- // We want to show the carrier name if in service and either:
- // - We are connected to mobile data, or
- // - We are not connected to mobile data, as long as the *reason* packets are not
- // being routed over that link is that we have better connectivity via wifi.
- // If data is disconnected for some other reason but wifi (or ethernet/bluetooth)
- // is connected, we show nothing.
- // Otherwise (nothing connected) we show "No internet connection".
- if (mCurrentState.dataConnected) {
- mobileLabel = mCurrentState.networkName;
- } else if (connected || mCurrentState.isEmergency) {
- if (mCurrentState.connected || mCurrentState.isEmergency) {
- // The isEmergencyOnly test covers the case of a phone with no SIM
- mobileLabel = mCurrentState.networkName;
- }
- } else {
- mobileLabel = mContext.getString(
- R.string.status_bar_settings_signal_meter_disconnected);
- }
-
- if (currentLabel.length() != 0) {
- currentLabel = currentLabel + mNetworkNameSeparator;
- }
- // Now for things that should only be shown when actually using mobile data.
- if (isMobileLabel) {
- return currentLabel + mobileLabel;
- } else {
- return currentLabel
- + (mCurrentState.dataConnected ? mobileLabel : currentLabel);
- }
- }
- }
-
- public int getDataContentDescription() {
- return getIcons().mDataContentDescription;
- }
-
- @VisibleForTesting
- protected IccCardConstants.State getSimState() {
- return mSimState;
- }
-
- public void setAirplaneMode(boolean airplaneMode) {
- mCurrentState.airplaneMode = airplaneMode;
- notifyListenersIfNecessary();
- }
-
- public void setInetCondition(int inetCondition, int inetConditionForNetwork) {
- // For mobile data, use general inet condition for phone signal indexing,
- // and network specific for data indexing (I think this might be a bug, but
- // keeping for now).
- // TODO: Update with explanation of why.
- mCurrentState.inetForNetwork = inetConditionForNetwork;
- setInetCondition(inetCondition);
- }
-
- /**
- * Start listening for phone state changes.
- */
- public void registerListener() {
- mPhone.listen(mPhoneStateListener,
- PhoneStateListener.LISTEN_SERVICE_STATE
- | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
- | PhoneStateListener.LISTEN_CALL_STATE
- | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
- | PhoneStateListener.LISTEN_DATA_ACTIVITY);
- }
-
- /**
- * Stop listening for phone state changes.
- */
- public void unregisterListener() {
- mPhone.listen(mPhoneStateListener, 0);
- }
-
- /**
- * Produce a mapping of data network types to icon groups for simple and quick use in
- * updateTelephony.
- */
- private void mapIconSets() {
- mNetworkToIconLookup.clear();
-
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_EVDO_0, TelephonyIcons.THREE_G);
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_EVDO_A, TelephonyIcons.THREE_G);
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_EVDO_B, TelephonyIcons.THREE_G);
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_EHRPD, TelephonyIcons.THREE_G);
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_UMTS, TelephonyIcons.THREE_G);
-
- if (!mConfig.showAtLeast3G) {
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_UNKNOWN,
- TelephonyIcons.UNKNOWN);
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_EDGE, TelephonyIcons.E);
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_CDMA, TelephonyIcons.ONE_X);
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_1xRTT, TelephonyIcons.ONE_X);
-
- mDefaultIcons = TelephonyIcons.G;
- } else {
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_UNKNOWN,
- TelephonyIcons.THREE_G);
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_EDGE,
- TelephonyIcons.THREE_G);
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_CDMA,
- TelephonyIcons.THREE_G);
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_1xRTT,
- TelephonyIcons.THREE_G);
- mDefaultIcons = TelephonyIcons.THREE_G;
- }
-
- MobileIconGroup hGroup = TelephonyIcons.THREE_G;
- if (mConfig.hspaDataDistinguishable) {
- hGroup = TelephonyIcons.H;
- }
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_HSDPA, hGroup);
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_HSUPA, hGroup);
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_HSPA, hGroup);
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_HSPAP, hGroup);
-
- if (mConfig.show4gForLte) {
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_LTE, TelephonyIcons.FOUR_G);
- } else {
- mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_LTE, TelephonyIcons.LTE);
- }
- }
-
- @Override
- public void notifyListeners() {
- MobileIconGroup icons = getIcons();
-
- String contentDescription = getStringIfExists(getContentDescription());
- String dataContentDescription = getStringIfExists(icons.mDataContentDescription);
- // Only send data sim callbacks to QS.
- if (mCurrentState.dataSim) {
- int qsTypeIcon = mCurrentState.dataConnected ?
- icons.mQsDataType[mCurrentState.inetForNetwork] : 0;
- int length = mSignalsChangedCallbacks.size();
- for (int i = 0; i < length; i++) {
- mSignalsChangedCallbacks.get(i).onMobileDataSignalChanged(mCurrentState.enabled
- && !mCurrentState.isEmergency && !mCurrentState.airplaneMode,
- getQsCurrentIconId(), contentDescription,
- qsTypeIcon,
- mCurrentState.dataConnected && mCurrentState.activityIn,
- mCurrentState.dataConnected && mCurrentState.activityOut,
- dataContentDescription,
- mCurrentState.isEmergency ? null : mCurrentState.networkName,
- // Only wide if actually showing something.
- icons.mIsWide && qsTypeIcon != 0);
- }
- }
- boolean showDataIcon = mCurrentState.dataConnected && mCurrentState.inetForNetwork != 0
- || mCurrentState.iconGroup == TelephonyIcons.ROAMING;
- int typeIcon = showDataIcon ? icons.mDataType : 0;
- int signalClustersLength = mSignalClusters.size();
- for (int i = 0; i < signalClustersLength; i++) {
- mSignalClusters.get(i).setMobileDataIndicators(
- mCurrentState.enabled && !mCurrentState.airplaneMode,
- getCurrentIconId(),
- typeIcon,
- contentDescription,
- dataContentDescription,
- // Only wide if actually showing something.
- icons.mIsWide && typeIcon != 0,
- mSubscriptionInfo.getSubscriptionId());
- }
- }
-
- @Override
- protected MobileState cleanState() {
- return new MobileState();
- }
-
- private boolean hasService() {
- if (mServiceState != null) {
- // Consider the device to be in service if either voice or data
- // service is available. Some SIM cards are marketed as data-only
- // and do not support voice service, and on these SIM cards, we
- // want to show signal bars for data service as well as the "no
- // service" or "emergency calls only" text that indicates that voice
- // is not available.
- switch (mServiceState.getVoiceRegState()) {
- case ServiceState.STATE_POWER_OFF:
- return false;
- case ServiceState.STATE_OUT_OF_SERVICE:
- case ServiceState.STATE_EMERGENCY_ONLY:
- return mServiceState.getDataRegState() == ServiceState.STATE_IN_SERVICE;
- default:
- return true;
- }
- } else {
- return false;
- }
- }
-
- private boolean isCdma() {
- return (mSignalStrength != null) && !mSignalStrength.isGsm();
- }
-
- public boolean isEmergencyOnly() {
- return (mServiceState != null && mServiceState.isEmergencyOnly());
- }
-
- private boolean isRoaming() {
- if (isCdma()) {
- final int iconMode = mServiceState.getCdmaEriIconMode();
- return mServiceState.getCdmaEriIconIndex() != EriInfo.ROAMING_INDICATOR_OFF
- && (iconMode == EriInfo.ROAMING_ICON_MODE_NORMAL
- || iconMode == EriInfo.ROAMING_ICON_MODE_FLASH);
- } else {
- return mServiceState != null && mServiceState.getRoaming();
- }
- }
-
- public void handleBroadcast(Intent intent) {
- String action = intent.getAction();
- if (action.equals(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION)) {
- updateNetworkName(intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_SPN, false),
- intent.getStringExtra(TelephonyIntents.EXTRA_SPN),
- intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_PLMN, false),
- intent.getStringExtra(TelephonyIntents.EXTRA_PLMN));
- notifyListenersIfNecessary();
- } else if (action.equals(TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED)) {
- updateDataSim();
- }
- }
-
- private void updateDataSim() {
- int defaultDataSub = SubscriptionManager.getDefaultDataSubId();
- if (SubscriptionManager.isValidSubscriptionId(defaultDataSub)) {
- mCurrentState.dataSim = defaultDataSub == mSubscriptionInfo.getSubscriptionId();
- } else {
- // There doesn't seem to be a data sim selected, however if
- // there isn't a MobileSignalController with dataSim set, then
- // QS won't get any callbacks and will be blank. Instead
- // lets just assume we are the data sim (which will basically
- // show one at random) in QS until one is selected. The user
- // should pick one soon after, so we shouldn't be in this state
- // for long.
- mCurrentState.dataSim = true;
- }
- notifyListenersIfNecessary();
- }
-
- /**
- * Updates the network's name based on incoming spn and plmn.
- */
- void updateNetworkName(boolean showSpn, String spn, boolean showPlmn, String plmn) {
- if (CHATTY) {
- Log.d("CarrierLabel", "updateNetworkName showSpn=" + showSpn + " spn=" + spn
- + " showPlmn=" + showPlmn + " plmn=" + plmn);
- }
- StringBuilder str = new StringBuilder();
- if (showPlmn && plmn != null) {
- str.append(plmn);
- }
- if (showSpn && spn != null) {
- if (str.length() != 0) {
- str.append(mNetworkNameSeparator);
- }
- str.append(spn);
- }
- if (str.length() != 0) {
- mCurrentState.networkName = str.toString();
- } else {
- mCurrentState.networkName = mNetworkNameDefault;
- }
- }
-
- /**
- * Updates the current state based on mServiceState, mSignalStrength, mDataNetType,
- * mDataState, and mSimState. It should be called any time one of these is updated.
- * This will call listeners if necessary.
- */
- private final void updateTelephony() {
- if (DEBUG) {
- Log.d(TAG, "updateTelephonySignalStrength: hasService=" + hasService()
- + " ss=" + mSignalStrength);
- }
- mCurrentState.connected = hasService() && mSignalStrength != null;
- if (mCurrentState.connected) {
- if (!mSignalStrength.isGsm() && mConfig.alwaysShowCdmaRssi) {
- mCurrentState.level = mSignalStrength.getCdmaLevel();
- } else {
- mCurrentState.level = mSignalStrength.getLevel();
- }
- }
- if (mNetworkToIconLookup.indexOfKey(mDataNetType) >= 0) {
- mCurrentState.iconGroup = mNetworkToIconLookup.get(mDataNetType);
- } else {
- mCurrentState.iconGroup = mDefaultIcons;
- }
- mCurrentState.dataConnected = mCurrentState.connected
- && mDataState == TelephonyManager.DATA_CONNECTED;
-
- if (isRoaming()) {
- mCurrentState.iconGroup = TelephonyIcons.ROAMING;
- }
- if (isEmergencyOnly() != mCurrentState.isEmergency) {
- mCurrentState.isEmergency = isEmergencyOnly();
- mNetworkController.recalculateEmergency();
- }
- // Fill in the network name if we think we have it.
- if (mCurrentState.networkName == mNetworkNameDefault && mServiceState != null
- && mServiceState.getOperatorAlphaShort() != null) {
- mCurrentState.networkName = mServiceState.getOperatorAlphaShort();
- }
- notifyListenersIfNecessary();
- }
-
- @VisibleForTesting
- void setActivity(int activity) {
- mCurrentState.activityIn = activity == TelephonyManager.DATA_ACTIVITY_INOUT
- || activity == TelephonyManager.DATA_ACTIVITY_IN;
- mCurrentState.activityOut = activity == TelephonyManager.DATA_ACTIVITY_INOUT
- || activity == TelephonyManager.DATA_ACTIVITY_OUT;
- notifyListenersIfNecessary();
- }
-
- @Override
- public void dump(PrintWriter pw) {
- super.dump(pw);
- pw.println(" mSubscription=" + mSubscriptionInfo + ",");
- pw.println(" mServiceState=" + mServiceState + ",");
- pw.println(" mSignalStrength=" + mSignalStrength + ",");
- pw.println(" mDataState=" + mDataState + ",");
- pw.println(" mDataNetType=" + mDataNetType + ",");
- }
-
- class MobilePhoneStateListener extends PhoneStateListener {
- public MobilePhoneStateListener(int subId) {
- super(subId);
- }
-
- @Override
- public void onSignalStrengthsChanged(SignalStrength signalStrength) {
- if (DEBUG) {
- Log.d(mTag, "onSignalStrengthsChanged signalStrength=" + signalStrength +
- ((signalStrength == null) ? "" : (" level=" + signalStrength.getLevel())));
- }
- mSignalStrength = signalStrength;
- updateTelephony();
- }
-
- @Override
- public void onServiceStateChanged(ServiceState state) {
- if (DEBUG) {
- Log.d(mTag, "onServiceStateChanged voiceState=" + state.getVoiceRegState()
- + " dataState=" + state.getDataRegState());
- }
- mServiceState = state;
- updateTelephony();
- }
-
- @Override
- public void onDataConnectionStateChanged(int state, int networkType) {
- if (DEBUG) {
- Log.d(mTag, "onDataConnectionStateChanged: state=" + state
- + " type=" + networkType);
- }
- mDataState = state;
- mDataNetType = networkType;
- updateTelephony();
- }
-
- @Override
- public void onDataActivity(int direction) {
- if (DEBUG) {
- Log.d(mTag, "onDataActivity: direction=" + direction);
- }
- setActivity(direction);
- }
- };
-
- static class MobileIconGroup extends SignalController.IconGroup {
- final int mDataContentDescription; // mContentDescriptionDataType
- final int mDataType;
- final boolean mIsWide;
- final int[] mQsDataType;
-
- public MobileIconGroup(String name, int[][] sbIcons, int[][] qsIcons, int[] contentDesc,
- int sbNullState, int qsNullState, int sbDiscState, int qsDiscState,
- int discContentDesc, int dataContentDesc, int dataType, boolean isWide,
- int[] qsDataType) {
- super(name, sbIcons, qsIcons, contentDesc, sbNullState, qsNullState, sbDiscState,
- qsDiscState, discContentDesc);
- mDataContentDescription = dataContentDesc;
- mDataType = dataType;
- mIsWide = isWide;
- mQsDataType = qsDataType;
- }
- }
-
- static class MobileState extends SignalController.State {
- String networkName;
- boolean dataSim;
- boolean dataConnected;
- boolean isEmergency;
- boolean airplaneMode;
- int inetForNetwork;
-
- @Override
- public void copyFrom(State s) {
- super.copyFrom(s);
- MobileState state = (MobileState) s;
- dataSim = state.dataSim;
- networkName = state.networkName;
- dataConnected = state.dataConnected;
- inetForNetwork = state.inetForNetwork;
- isEmergency = state.isEmergency;
- airplaneMode = state.airplaneMode;
- }
-
- @Override
- protected void toString(StringBuilder builder) {
- super.toString(builder);
- builder.append(',');
- builder.append("dataSim=").append(dataSim).append(',');
- builder.append("networkName=").append(networkName).append(',');
- builder.append("dataConnected=").append(dataConnected).append(',');
- builder.append("inetForNetwork=").append(inetForNetwork).append(',');
- builder.append("isEmergency=").append(isEmergency).append(',');
- builder.append("airplaneMode=").append(airplaneMode);
- }
-
- @Override
- public boolean equals(Object o) {
- return super.equals(o)
- && Objects.equals(((MobileState) o).networkName, networkName)
- && ((MobileState) o).dataSim == dataSim
- && ((MobileState) o).dataConnected == dataConnected
- && ((MobileState) o).isEmergency == isEmergency
- && ((MobileState) o).airplaneMode == airplaneMode
- && ((MobileState) o).inetForNetwork == inetForNetwork;
- }
- }
- }
-
- /**
- * Common base class for handling signal for both wifi and mobile data.
- */
- static abstract class SignalController<T extends SignalController.State,
- I extends SignalController.IconGroup> {
- protected final String mTag;
- protected final T mCurrentState;
- protected final T mLastState;
- protected final int mTransportType;
- protected final Context mContext;
- // The owner of the SignalController (i.e. NetworkController will maintain the following
- // lists and call notifyListeners whenever the list has changed to ensure everyone
- // is aware of current state.
- protected final List<NetworkSignalChangedCallback> mSignalsChangedCallbacks;
- protected final List<SignalCluster> mSignalClusters;
- protected final NetworkControllerImpl mNetworkController;
-
- // Save the previous HISTORY_SIZE states for logging.
- private final State[] mHistory;
- // Where to copy the next state into.
- private int mHistoryIndex;
-
- public SignalController(String tag, Context context, int type,
- List<NetworkSignalChangedCallback> signalCallbacks,
- List<SignalCluster> signalClusters, NetworkControllerImpl networkController) {
- mTag = TAG + "." + tag;
- mNetworkController = networkController;
- mTransportType = type;
- mContext = context;
- mSignalsChangedCallbacks = signalCallbacks;
- mSignalClusters = signalClusters;
- mCurrentState = cleanState();
- mLastState = cleanState();
- if (RECORD_HISTORY) {
- mHistory = new State[HISTORY_SIZE];
- for (int i = 0; i < HISTORY_SIZE; i++) {
- mHistory[i] = cleanState();
- }
- }
- }
-
- public T getState() {
- return mCurrentState;
- }
-
- public int getTransportType() {
- return mTransportType;
- }
-
- public void setInetCondition(int inetCondition) {
- mCurrentState.inetCondition = inetCondition;
- notifyListenersIfNecessary();
- }
-
- /**
- * Used at the end of demo mode to clear out any ugly state that it has created.
- * Since we haven't had any callbacks, then isDirty will not have been triggered,
- * so we can just take the last good state directly from there.
- *
- * Used for demo mode.
- */
- void resetLastState() {
- mCurrentState.copyFrom(mLastState);
- }
-
- /**
- * Determines if the state of this signal controller has changed and
- * needs to trigger callbacks related to it.
- */
- public boolean isDirty() {
- if (!mLastState.equals(mCurrentState)) {
- if (DEBUG) {
- Log.d(mTag, "Change in state from: " + mLastState + "\n"
- + "\tto: " + mCurrentState);
- }
- return true;
- }
- return false;
- }
-
- public void saveLastState() {
- if (RECORD_HISTORY) {
- recordLastState();
- }
- // Updates the current time.
- mCurrentState.time = System.currentTimeMillis();
- mLastState.copyFrom(mCurrentState);
- }
-
- /**
- * Gets the signal icon for QS based on current state of connected, enabled, and level.
- */
- public int getQsCurrentIconId() {
- if (mCurrentState.connected) {
- return getIcons().mQsIcons[mCurrentState.inetCondition][mCurrentState.level];
- } else if (mCurrentState.enabled) {
- return getIcons().mQsDiscState;
- } else {
- return getIcons().mQsNullState;
- }
- }
-
- /**
- * Gets the signal icon for SB based on current state of connected, enabled, and level.
- */
- public int getCurrentIconId() {
- if (mCurrentState.connected) {
- return getIcons().mSbIcons[mCurrentState.inetCondition][mCurrentState.level];
- } else if (mCurrentState.enabled) {
- return getIcons().mSbDiscState;
- } else {
- return getIcons().mSbNullState;
- }
- }
-
- /**
- * Gets the content description id for the signal based on current state of connected and
- * level.
- */
- public int getContentDescription() {
- if (mCurrentState.connected) {
- return getIcons().mContentDesc[mCurrentState.level];
- } else {
- return getIcons().mDiscContentDesc;
- }
- }
-
- public void notifyListenersIfNecessary() {
- if (isDirty()) {
- saveLastState();
- notifyListeners();
- mNetworkController.refreshCarrierLabel();
- }
- }
-
- /**
- * Returns the resource if resId is not 0, and an empty string otherwise.
- */
- protected String getStringIfExists(int resId) {
- return resId != 0 ? mContext.getString(resId) : "";
- }
-
- protected I getIcons() {
- return (I) mCurrentState.iconGroup;
- }
-
- /**
- * Saves the last state of any changes, so we can log the current
- * and last value of any state data.
- */
- protected void recordLastState() {
- mHistory[mHistoryIndex++ & (HISTORY_SIZE - 1)].copyFrom(mLastState);
- }
-
- public void dump(PrintWriter pw) {
- pw.println(" - " + mTag + " -----");
- pw.println(" Current State: " + mCurrentState);
- if (RECORD_HISTORY) {
- // Count up the states that actually contain time stamps, and only display those.
- int size = 0;
- for (int i = 0; i < HISTORY_SIZE; i++) {
- if (mHistory[i].time != 0) size++;
- }
- // Print out the previous states in ordered number.
- for (int i = mHistoryIndex + HISTORY_SIZE - 1;
- i >= mHistoryIndex + HISTORY_SIZE - size; i--) {
- pw.println(" Previous State(" + (mHistoryIndex + HISTORY_SIZE - i) + ": "
- + mHistory[i & (HISTORY_SIZE - 1)]);
- }
- }
- }
-
- /**
- * Trigger callbacks based on current state. The callbacks should be completely
- * based on current state, and only need to be called in the scenario where
- * mCurrentState != mLastState.
- */
- public abstract void notifyListeners();
-
- /**
- * Generate a blank T.
- */
- protected abstract T cleanState();
-
- /*
- * Holds icons for a given state. Arrays are generally indexed as inet
- * state (full connectivity or not) first, and second dimension as
- * signal strength.
- */
- static class IconGroup {
- final int[][] mSbIcons;
- final int[][] mQsIcons;
- final int[] mContentDesc;
- final int mSbNullState;
- final int mQsNullState;
- final int mSbDiscState;
- final int mQsDiscState;
- final int mDiscContentDesc;
- // For logging.
- final String mName;
-
- public IconGroup(String name, int[][] sbIcons, int[][] qsIcons, int[] contentDesc,
- int sbNullState, int qsNullState, int sbDiscState, int qsDiscState,
- int discContentDesc) {
- mName = name;
- mSbIcons = sbIcons;
- mQsIcons = qsIcons;
- mContentDesc = contentDesc;
- mSbNullState = sbNullState;
- mQsNullState = qsNullState;
- mSbDiscState = sbDiscState;
- mQsDiscState = qsDiscState;
- mDiscContentDesc = discContentDesc;
- }
-
- @Override
- public String toString() {
- return "IconGroup(" + mName + ")";
- }
- }
-
- static class State {
- boolean connected;
- boolean enabled;
- boolean activityIn;
- boolean activityOut;
- int level;
- IconGroup iconGroup;
- int inetCondition;
- int rssi; // Only for logging.
-
- // Not used for comparison, just used for logging.
- long time;
-
- public void copyFrom(State state) {
- connected = state.connected;
- enabled = state.enabled;
- level = state.level;
- iconGroup = state.iconGroup;
- inetCondition = state.inetCondition;
- activityIn = state.activityIn;
- activityOut = state.activityOut;
- rssi = state.rssi;
- time = state.time;
- }
-
- @Override
- public String toString() {
- if (time != 0) {
- StringBuilder builder = new StringBuilder();
- toString(builder);
- return builder.toString();
- } else {
- return "Empty " + getClass().getSimpleName();
- }
- }
-
- protected void toString(StringBuilder builder) {
- builder.append("connected=").append(connected).append(',')
- .append("enabled=").append(enabled).append(',')
- .append("level=").append(level).append(',')
- .append("inetCondition=").append(inetCondition).append(',')
- .append("iconGroup=").append(iconGroup).append(',')
- .append("activityIn=").append(activityIn).append(',')
- .append("activityOut=").append(activityOut).append(',')
- .append("rssi=").append(rssi).append(',')
- .append("lastModified=").append(DateFormat.format("MM-dd hh:mm:ss", time));
- }
-
- @Override
- public boolean equals(Object o) {
- if (!o.getClass().equals(getClass())) {
- return false;
- }
- State other = (State) o;
- return other.connected == connected
- && other.enabled == enabled
- && other.level == level
- && other.inetCondition == inetCondition
- && other.iconGroup == iconGroup
- && other.activityIn == activityIn
- && other.activityOut == activityOut
- && other.rssi == rssi;
- }
- }
- }
-
public interface SignalCluster {
void setWifiIndicators(boolean visible, int strengthIcon, String contentDescription);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java
new file mode 100644
index 0000000..14c3d9c
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java
@@ -0,0 +1,324 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.systemui.statusbar.policy;
+
+import static com.android.systemui.statusbar.policy.NetworkControllerImpl.TAG;
+
+import android.content.Context;
+import android.text.format.DateFormat;
+import android.util.Log;
+
+import com.android.systemui.statusbar.policy.NetworkController.NetworkSignalChangedCallback;
+import com.android.systemui.statusbar.policy.NetworkControllerImpl.SignalCluster;
+
+import java.io.PrintWriter;
+import java.util.List;
+
+
+/**
+ * Common base class for handling signal for both wifi and mobile data.
+ */
+public abstract class SignalController<T extends SignalController.State,
+ I extends SignalController.IconGroup> {
+ // Save the previous SignalController.States of all SignalControllers for dumps.
+ static final boolean RECORD_HISTORY = true;
+ // If RECORD_HISTORY how many to save, must be a power of 2.
+ static final int HISTORY_SIZE = 16;
+
+ protected static final boolean DEBUG = NetworkControllerImpl.DEBUG;
+ protected static final boolean CHATTY = NetworkControllerImpl.CHATTY;
+
+ protected final String mTag;
+ protected final T mCurrentState;
+ protected final T mLastState;
+ protected final int mTransportType;
+ protected final Context mContext;
+ // The owner of the SignalController (i.e. NetworkController will maintain the following
+ // lists and call notifyListeners whenever the list has changed to ensure everyone
+ // is aware of current state.
+ protected final List<NetworkSignalChangedCallback> mSignalsChangedCallbacks;
+ protected final List<SignalCluster> mSignalClusters;
+ protected final NetworkControllerImpl mNetworkController;
+
+ // Save the previous HISTORY_SIZE states for logging.
+ private final State[] mHistory;
+ // Where to copy the next state into.
+ private int mHistoryIndex;
+
+ public SignalController(String tag, Context context, int type,
+ List<NetworkSignalChangedCallback> signalCallbacks,
+ List<SignalCluster> signalClusters, NetworkControllerImpl networkController) {
+ mTag = TAG + "." + tag;
+ mNetworkController = networkController;
+ mTransportType = type;
+ mContext = context;
+ mSignalsChangedCallbacks = signalCallbacks;
+ mSignalClusters = signalClusters;
+ mCurrentState = cleanState();
+ mLastState = cleanState();
+ if (RECORD_HISTORY) {
+ mHistory = new State[HISTORY_SIZE];
+ for (int i = 0; i < HISTORY_SIZE; i++) {
+ mHistory[i] = cleanState();
+ }
+ }
+ }
+
+ public T getState() {
+ return mCurrentState;
+ }
+
+ public int getTransportType() {
+ return mTransportType;
+ }
+
+ public void setInetCondition(int inetCondition) {
+ mCurrentState.inetCondition = inetCondition;
+ notifyListenersIfNecessary();
+ }
+
+ /**
+ * Used at the end of demo mode to clear out any ugly state that it has created.
+ * Since we haven't had any callbacks, then isDirty will not have been triggered,
+ * so we can just take the last good state directly from there.
+ *
+ * Used for demo mode.
+ */
+ public void resetLastState() {
+ mCurrentState.copyFrom(mLastState);
+ }
+
+ /**
+ * Determines if the state of this signal controller has changed and
+ * needs to trigger callbacks related to it.
+ */
+ public boolean isDirty() {
+ if (!mLastState.equals(mCurrentState)) {
+ if (DEBUG) {
+ Log.d(mTag, "Change in state from: " + mLastState + "\n"
+ + "\tto: " + mCurrentState);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public void saveLastState() {
+ if (RECORD_HISTORY) {
+ recordLastState();
+ }
+ // Updates the current time.
+ mCurrentState.time = System.currentTimeMillis();
+ mLastState.copyFrom(mCurrentState);
+ }
+
+ /**
+ * Gets the signal icon for QS based on current state of connected, enabled, and level.
+ */
+ public int getQsCurrentIconId() {
+ if (mCurrentState.connected) {
+ return getIcons().mQsIcons[mCurrentState.inetCondition][mCurrentState.level];
+ } else if (mCurrentState.enabled) {
+ return getIcons().mQsDiscState;
+ } else {
+ return getIcons().mQsNullState;
+ }
+ }
+
+ /**
+ * Gets the signal icon for SB based on current state of connected, enabled, and level.
+ */
+ public int getCurrentIconId() {
+ if (mCurrentState.connected) {
+ return getIcons().mSbIcons[mCurrentState.inetCondition][mCurrentState.level];
+ } else if (mCurrentState.enabled) {
+ return getIcons().mSbDiscState;
+ } else {
+ return getIcons().mSbNullState;
+ }
+ }
+
+ /**
+ * Gets the content description id for the signal based on current state of connected and
+ * level.
+ */
+ public int getContentDescription() {
+ if (mCurrentState.connected) {
+ return getIcons().mContentDesc[mCurrentState.level];
+ } else {
+ return getIcons().mDiscContentDesc;
+ }
+ }
+
+ public void notifyListenersIfNecessary() {
+ if (isDirty()) {
+ saveLastState();
+ notifyListeners();
+ mNetworkController.refreshCarrierLabel();
+ }
+ }
+
+ /**
+ * Returns the resource if resId is not 0, and an empty string otherwise.
+ */
+ protected String getStringIfExists(int resId) {
+ return resId != 0 ? mContext.getString(resId) : "";
+ }
+
+ protected I getIcons() {
+ return (I) mCurrentState.iconGroup;
+ }
+
+ /**
+ * Saves the last state of any changes, so we can log the current
+ * and last value of any state data.
+ */
+ protected void recordLastState() {
+ mHistory[mHistoryIndex++ & (HISTORY_SIZE - 1)].copyFrom(mLastState);
+ }
+
+ public void dump(PrintWriter pw) {
+ pw.println(" - " + mTag + " -----");
+ pw.println(" Current State: " + mCurrentState);
+ if (RECORD_HISTORY) {
+ // Count up the states that actually contain time stamps, and only display those.
+ int size = 0;
+ for (int i = 0; i < HISTORY_SIZE; i++) {
+ if (mHistory[i].time != 0) size++;
+ }
+ // Print out the previous states in ordered number.
+ for (int i = mHistoryIndex + HISTORY_SIZE - 1;
+ i >= mHistoryIndex + HISTORY_SIZE - size; i--) {
+ pw.println(" Previous State(" + (mHistoryIndex + HISTORY_SIZE - i) + "): "
+ + mHistory[i & (HISTORY_SIZE - 1)]);
+ }
+ }
+ }
+
+ /**
+ * Trigger callbacks based on current state. The callbacks should be completely
+ * based on current state, and only need to be called in the scenario where
+ * mCurrentState != mLastState.
+ */
+ public abstract void notifyListeners();
+
+ /**
+ * Generate a blank T.
+ */
+ protected abstract T cleanState();
+
+ /*
+ * Holds icons for a given state. Arrays are generally indexed as inet
+ * state (full connectivity or not) first, and second dimension as
+ * signal strength.
+ */
+ static class IconGroup {
+ final int[][] mSbIcons;
+ final int[][] mQsIcons;
+ final int[] mContentDesc;
+ final int mSbNullState;
+ final int mQsNullState;
+ final int mSbDiscState;
+ final int mQsDiscState;
+ final int mDiscContentDesc;
+ // For logging.
+ final String mName;
+
+ public IconGroup(String name, int[][] sbIcons, int[][] qsIcons, int[] contentDesc,
+ int sbNullState, int qsNullState, int sbDiscState, int qsDiscState,
+ int discContentDesc) {
+ mName = name;
+ mSbIcons = sbIcons;
+ mQsIcons = qsIcons;
+ mContentDesc = contentDesc;
+ mSbNullState = sbNullState;
+ mQsNullState = qsNullState;
+ mSbDiscState = sbDiscState;
+ mQsDiscState = qsDiscState;
+ mDiscContentDesc = discContentDesc;
+ }
+
+ @Override
+ public String toString() {
+ return "IconGroup(" + mName + ")";
+ }
+ }
+
+ static class State {
+ boolean connected;
+ boolean enabled;
+ boolean activityIn;
+ boolean activityOut;
+ int level;
+ IconGroup iconGroup;
+ int inetCondition;
+ int rssi; // Only for logging.
+
+ // Not used for comparison, just used for logging.
+ long time;
+
+ public void copyFrom(State state) {
+ connected = state.connected;
+ enabled = state.enabled;
+ level = state.level;
+ iconGroup = state.iconGroup;
+ inetCondition = state.inetCondition;
+ activityIn = state.activityIn;
+ activityOut = state.activityOut;
+ rssi = state.rssi;
+ time = state.time;
+ }
+
+ @Override
+ public String toString() {
+ if (time != 0) {
+ StringBuilder builder = new StringBuilder();
+ toString(builder);
+ return builder.toString();
+ } else {
+ return "Empty " + getClass().getSimpleName();
+ }
+ }
+
+ protected void toString(StringBuilder builder) {
+ builder.append("connected=").append(connected).append(',')
+ .append("enabled=").append(enabled).append(',')
+ .append("level=").append(level).append(',')
+ .append("inetCondition=").append(inetCondition).append(',')
+ .append("iconGroup=").append(iconGroup).append(',')
+ .append("activityIn=").append(activityIn).append(',')
+ .append("activityOut=").append(activityOut).append(',')
+ .append("rssi=").append(rssi).append(',')
+ .append("lastModified=").append(DateFormat.format("MM-dd hh:mm:ss", time));
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!o.getClass().equals(getClass())) {
+ return false;
+ }
+ State other = (State) o;
+ return other.connected == connected
+ && other.enabled == enabled
+ && other.level == level
+ && other.inetCondition == inetCondition
+ && other.iconGroup == iconGroup
+ && other.activityIn == activityIn
+ && other.activityOut == activityOut
+ && other.rssi == rssi;
+ }
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
index 4091619..d266ed8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
@@ -17,7 +17,7 @@
package com.android.systemui.statusbar.policy;
import com.android.systemui.R;
-import com.android.systemui.statusbar.policy.NetworkControllerImpl.MobileSignalController.MobileIconGroup;
+import com.android.systemui.statusbar.policy.MobileSignalController.MobileIconGroup;
class TelephonyIcons {
//***** Signal strength icons
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java
new file mode 100644
index 0000000..a97ca50
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java
@@ -0,0 +1,208 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.systemui.statusbar.policy;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.NetworkCapabilities;
+import android.net.NetworkInfo;
+import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiInfo;
+import android.net.wifi.WifiManager;
+import android.os.Handler;
+import android.os.Message;
+import android.os.Messenger;
+import android.util.Log;
+
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.util.AsyncChannel;
+import com.android.systemui.statusbar.policy.NetworkController.NetworkSignalChangedCallback;
+import com.android.systemui.statusbar.policy.NetworkControllerImpl.SignalCluster;
+
+import java.util.List;
+import java.util.Objects;
+
+
+public class WifiSignalController extends
+ SignalController<WifiSignalController.WifiState, SignalController.IconGroup> {
+ private final WifiManager mWifiManager;
+ private final AsyncChannel mWifiChannel;
+ private final boolean mHasMobileData;
+
+ public WifiSignalController(Context context, boolean hasMobileData,
+ List<NetworkSignalChangedCallback> signalCallbacks,
+ List<SignalCluster> signalClusters, NetworkControllerImpl networkController) {
+ super("WifiSignalController", context, NetworkCapabilities.TRANSPORT_WIFI,
+ signalCallbacks, signalClusters, networkController);
+ mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
+ mHasMobileData = hasMobileData;
+ Handler handler = new WifiHandler();
+ mWifiChannel = new AsyncChannel();
+ Messenger wifiMessenger = mWifiManager.getWifiServiceMessenger();
+ if (wifiMessenger != null) {
+ mWifiChannel.connect(context, handler, wifiMessenger);
+ }
+ // WiFi only has one state.
+ mCurrentState.iconGroup = mLastState.iconGroup = new IconGroup(
+ "Wi-Fi Icons",
+ WifiIcons.WIFI_SIGNAL_STRENGTH,
+ WifiIcons.QS_WIFI_SIGNAL_STRENGTH,
+ AccessibilityContentDescriptions.WIFI_CONNECTION_STRENGTH,
+ WifiIcons.WIFI_NO_NETWORK,
+ WifiIcons.QS_WIFI_NO_NETWORK,
+ WifiIcons.WIFI_NO_NETWORK,
+ WifiIcons.QS_WIFI_NO_NETWORK,
+ AccessibilityContentDescriptions.WIFI_NO_CONNECTION
+ );
+ }
+
+ @Override
+ protected WifiState cleanState() {
+ return new WifiState();
+ }
+
+ @Override
+ public void notifyListeners() {
+ // only show wifi in the cluster if connected or if wifi-only
+ boolean wifiVisible = mCurrentState.enabled
+ && (mCurrentState.connected || !mHasMobileData);
+ String wifiDesc = wifiVisible ? mCurrentState.ssid : null;
+ boolean ssidPresent = wifiVisible && mCurrentState.ssid != null;
+ String contentDescription = getStringIfExists(getContentDescription());
+ int length = mSignalsChangedCallbacks.size();
+ for (int i = 0; i < length; i++) {
+ mSignalsChangedCallbacks.get(i).onWifiSignalChanged(mCurrentState.enabled,
+ mCurrentState.connected, getQsCurrentIconId(),
+ ssidPresent && mCurrentState.activityIn,
+ ssidPresent && mCurrentState.activityOut, contentDescription, wifiDesc);
+ }
+
+ int signalClustersLength = mSignalClusters.size();
+ for (int i = 0; i < signalClustersLength; i++) {
+ mSignalClusters.get(i).setWifiIndicators(wifiVisible, getCurrentIconId(),
+ contentDescription);
+ }
+ }
+
+ /**
+ * Extract wifi state directly from broadcasts about changes in wifi state.
+ */
+ public void handleBroadcast(Intent intent) {
+ String action = intent.getAction();
+ if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
+ mCurrentState.enabled = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
+ WifiManager.WIFI_STATE_UNKNOWN) == WifiManager.WIFI_STATE_ENABLED;
+ } else if (action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
+ final NetworkInfo networkInfo = (NetworkInfo)
+ intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
+ mCurrentState.connected = networkInfo != null && networkInfo.isConnected();
+ // If Connected grab the signal strength and ssid.
+ if (mCurrentState.connected) {
+ // try getting it out of the intent first
+ WifiInfo info = intent.getParcelableExtra(WifiManager.EXTRA_WIFI_INFO) != null
+ ? (WifiInfo) intent.getParcelableExtra(WifiManager.EXTRA_WIFI_INFO)
+ : mWifiManager.getConnectionInfo();
+ if (info != null) {
+ mCurrentState.ssid = getSsid(info);
+ } else {
+ mCurrentState.ssid = null;
+ }
+ } else if (!mCurrentState.connected) {
+ mCurrentState.ssid = null;
+ }
+ } else if (action.equals(WifiManager.RSSI_CHANGED_ACTION)) {
+ // Default to -200 as its below WifiManager.MIN_RSSI.
+ mCurrentState.rssi = intent.getIntExtra(WifiManager.EXTRA_NEW_RSSI, -200);
+ mCurrentState.level = WifiManager.calculateSignalLevel(
+ mCurrentState.rssi, WifiIcons.WIFI_LEVEL_COUNT);
+ }
+
+ notifyListenersIfNecessary();
+ }
+
+ private String getSsid(WifiInfo info) {
+ String ssid = info.getSSID();
+ if (ssid != null) {
+ return ssid;
+ }
+ // OK, it's not in the connectionInfo; we have to go hunting for it
+ List<WifiConfiguration> networks = mWifiManager.getConfiguredNetworks();
+ int length = networks.size();
+ for (int i = 0; i < length; i++) {
+ if (networks.get(i).networkId == info.getNetworkId()) {
+ return networks.get(i).SSID;
+ }
+ }
+ return null;
+ }
+
+ @VisibleForTesting
+ void setActivity(int wifiActivity) {
+ mCurrentState.activityIn = wifiActivity == WifiManager.DATA_ACTIVITY_INOUT
+ || wifiActivity == WifiManager.DATA_ACTIVITY_IN;
+ mCurrentState.activityOut = wifiActivity == WifiManager.DATA_ACTIVITY_INOUT
+ || wifiActivity == WifiManager.DATA_ACTIVITY_OUT;
+ notifyListenersIfNecessary();
+ }
+
+ /**
+ * Handler to receive the data activity on wifi.
+ */
+ private class WifiHandler extends Handler {
+ @Override
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case AsyncChannel.CMD_CHANNEL_HALF_CONNECTED:
+ if (msg.arg1 == AsyncChannel.STATUS_SUCCESSFUL) {
+ mWifiChannel.sendMessage(Message.obtain(this,
+ AsyncChannel.CMD_CHANNEL_FULL_CONNECTION));
+ } else {
+ Log.e(mTag, "Failed to connect to wifi");
+ }
+ break;
+ case WifiManager.DATA_ACTIVITY_NOTIFICATION:
+ setActivity(msg.arg1);
+ break;
+ default:
+ // Ignore
+ break;
+ }
+ }
+ }
+
+ static class WifiState extends SignalController.State {
+ String ssid;
+
+ @Override
+ public void copyFrom(State s) {
+ super.copyFrom(s);
+ WifiState state = (WifiState) s;
+ ssid = state.ssid;
+ }
+
+ @Override
+ protected void toString(StringBuilder builder) {
+ super.toString(builder);
+ builder.append(',').append("ssid=").append(ssid);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return super.equals(o)
+ && Objects.equals(((WifiState) o).ssid, ssid);
+ }
+ }
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
index 8a2d62f..9b95d5c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
@@ -1,17 +1,24 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.android.systemui.statusbar.policy;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkCapabilities;
@@ -26,13 +33,19 @@
import android.util.Log;
import com.android.internal.telephony.IccCardConstants;
-import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.cdma.EriInfo;
import com.android.systemui.statusbar.policy.NetworkController.NetworkSignalChangedCallback;
import com.android.systemui.statusbar.policy.NetworkControllerImpl.Config;
-import com.android.systemui.statusbar.policy.NetworkControllerImpl.MobileSignalController;
import com.android.systemui.statusbar.policy.NetworkControllerImpl.SignalCluster;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
public class NetworkControllerBaseTest extends AndroidTestCase {
private static final String TAG = "NetworkControllerBaseTest";
protected static final int DEFAULT_LEVEL = 2;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
index 142c7e6..65b0971 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
@@ -1,12 +1,21 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.android.systemui.statusbar.policy;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.mockito.Mockito;
import android.content.Intent;
import android.net.ConnectivityManager;
@@ -18,7 +27,11 @@
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.systemui.R;
-import com.android.systemui.statusbar.policy.NetworkControllerImpl.MobileSignalController;
+
+import org.mockito.Mockito;
+
+import java.util.ArrayList;
+import java.util.List;
public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 3be3cf1..9137da310 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -3619,6 +3619,10 @@
if (task == null) {
throw new IllegalArgumentException("Task " + taskId + " not found.");
}
+ if (task.getRootActivity() != null) {
+ moveTaskToFrontLocked(task.taskId, 0, null);
+ return ActivityManager.START_TASK_TO_FRONT;
+ }
callingUid = task.mCallingUid;
callingPackage = task.mCallingPackage;
intent = task.intent;
@@ -19445,20 +19449,8 @@
@Override
public void moveToFront() {
checkCaller();
-
- final TaskRecord tr;
- synchronized (ActivityManagerService.this) {
- tr = recentTaskForIdLocked(mTaskId);
- if (tr == null) {
- throw new IllegalArgumentException("Unable to find task ID " + mTaskId);
- }
- if (tr.getRootActivity() != null) {
- moveTaskToFrontLocked(tr.taskId, 0, null);
- return;
- }
- }
-
- startActivityFromRecentsInner(tr.taskId, null);
+ // Will bring task to front if it already has a root activity.
+ startActivityFromRecentsInner(mTaskId, null);
}
@Override
diff --git a/services/core/java/com/android/server/notification/NotificationUsageStats.java b/services/core/java/com/android/server/notification/NotificationUsageStats.java
index 3d13d21..e029c58 100644
--- a/services/core/java/com/android/server/notification/NotificationUsageStats.java
+++ b/services/core/java/com/android/server/notification/NotificationUsageStats.java
@@ -222,7 +222,7 @@
public void collect(SingleNotificationStats singleNotificationStats) {
posttimeMs.addSample(
- SystemClock.elapsedRealtime() - singleNotificationStats.posttimeElapsedMs);
+ SystemClock.elapsedRealtime() - singleNotificationStats.posttimeElapsedMs);
if (singleNotificationStats.posttimeToDismissMs >= 0) {
posttimeToDismissMs.addSample(singleNotificationStats.posttimeToDismissMs);
}