summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jim Miller <jaggies@google.com> 2011-08-04 18:06:03 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2011-08-04 18:06:03 -0700
commitf1eaf7f4394fa0dc3d788f3f7816f686f514fca5 (patch)
tree4ddfa90a840a5bd3f4d49b1f022a3c74cb22f250
parent61d7cd460c24b71406864fc41409f44964cdbc09 (diff)
parentbe8d1cf1ac9fc514fb0cc2e8ef4a85beb0197fa0 (diff)
Merge "Fix 5045008: replace "ring/silence" target in LockScreen with camera app"
-rw-r--r--core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java6
-rw-r--r--core/res/res/drawable-hdpi/ic_lockscreen_camera_activated.pngbin0 -> 8109 bytes
-rw-r--r--core/res/res/drawable-hdpi/ic_lockscreen_camera_normal.pngbin0 -> 2411 bytes
-rw-r--r--core/res/res/drawable-hdpi/ic_lockscreen_silent_activated.pngbin7649 -> 7786 bytes
-rw-r--r--core/res/res/drawable-hdpi/ic_lockscreen_soundon_activated.pngbin7114 -> 7452 bytes
-rw-r--r--core/res/res/drawable-hdpi/ic_lockscreen_text_activated.pngbin6357 -> 6815 bytes
-rw-r--r--core/res/res/drawable-hdpi/ic_lockscreen_unlock_activated.pngbin6429 -> 6729 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_lockscreen_camera_activated.pngbin0 -> 4951 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_lockscreen_camera_normal.pngbin0 -> 1572 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_lockscreen_silent_activated.pngbin4462 -> 4740 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_lockscreen_soundon_activated.pngbin4231 -> 4538 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_lockscreen_text_activated.pngbin3872 -> 4246 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_lockscreen_unlock_activated.pngbin3941 -> 4231 bytes
-rw-r--r--core/res/res/drawable-xhdpi/ic_lockscreen_camera_activated.pngbin0 -> 11602 bytes
-rw-r--r--core/res/res/drawable-xhdpi/ic_lockscreen_camera_normal.pngbin0 -> 3380 bytes
-rw-r--r--core/res/res/drawable-xhdpi/ic_lockscreen_silent_activated.pngbin11341 -> 11182 bytes
-rw-r--r--core/res/res/drawable-xhdpi/ic_lockscreen_soundon_activated.pngbin10439 -> 10638 bytes
-rw-r--r--core/res/res/drawable-xhdpi/ic_lockscreen_text_activated.pngbin9196 -> 9635 bytes
-rw-r--r--core/res/res/drawable-xhdpi/ic_lockscreen_unlock_activated.pngbin9353 -> 9630 bytes
-rw-r--r--core/res/res/drawable/ic_lockscreen_camera.xml30
-rw-r--r--core/res/res/layout/keyguard_screen_tab_unlock.xml2
-rw-r--r--core/res/res/layout/keyguard_screen_tab_unlock_land.xml2
-rw-r--r--core/res/res/values-land/arrays.xml7
-rw-r--r--core/res/res/values/arrays.xml7
-rw-r--r--policy/src/com/android/internal/policy/impl/LockScreen.java42
25 files changed, 87 insertions, 9 deletions
diff --git a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
index 0510023b8d04..ec926e4fdfe9 100644
--- a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
+++ b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
@@ -127,6 +127,7 @@ public class MultiWaveView extends View {
mAnimatingTargets = false;
}
};
+ private int mTargetResourceId;
public MultiWaveView(Context context) {
this(context, null);
@@ -474,6 +475,7 @@ public class MultiWaveView extends View {
Drawable drawable = array.getDrawable(i);
targetDrawables.add(new TargetDrawable(res, drawable));
}
+ mTargetResourceId = resourceId;
mTargetDrawables = targetDrawables;
updateTargetPositions();
}
@@ -492,6 +494,10 @@ public class MultiWaveView extends View {
}
}
+ public int getTargetResourceId() {
+ return mTargetResourceId;
+ }
+
/**
* Enable or disable vibrate on touch.
*
diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_camera_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_camera_activated.png
new file mode 100644
index 000000000000..d510e1dd710c
--- /dev/null
+++ b/core/res/res/drawable-hdpi/ic_lockscreen_camera_activated.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_camera_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_camera_normal.png
new file mode 100644
index 000000000000..36d766d76a94
--- /dev/null
+++ b/core/res/res/drawable-hdpi/ic_lockscreen_camera_normal.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_silent_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_silent_activated.png
index fce4980c74b8..d1938b99bcce 100644
--- a/core/res/res/drawable-hdpi/ic_lockscreen_silent_activated.png
+++ b/core/res/res/drawable-hdpi/ic_lockscreen_silent_activated.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_soundon_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_soundon_activated.png
index 73f01c9e859c..f6ccbd29a8cd 100644
--- a/core/res/res/drawable-hdpi/ic_lockscreen_soundon_activated.png
+++ b/core/res/res/drawable-hdpi/ic_lockscreen_soundon_activated.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_text_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_text_activated.png
index d01bdb273f7e..10b32682c185 100644
--- a/core/res/res/drawable-hdpi/ic_lockscreen_text_activated.png
+++ b/core/res/res/drawable-hdpi/ic_lockscreen_text_activated.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_unlock_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_unlock_activated.png
index d333946642aa..d1f30156f163 100644
--- a/core/res/res/drawable-hdpi/ic_lockscreen_unlock_activated.png
+++ b/core/res/res/drawable-hdpi/ic_lockscreen_unlock_activated.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_camera_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_camera_activated.png
new file mode 100644
index 000000000000..1437798cb9d7
--- /dev/null
+++ b/core/res/res/drawable-mdpi/ic_lockscreen_camera_activated.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_camera_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_camera_normal.png
new file mode 100644
index 000000000000..b71825855a89
--- /dev/null
+++ b/core/res/res/drawable-mdpi/ic_lockscreen_camera_normal.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_silent_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_silent_activated.png
index 3b2f3fc8579b..2bc3f52b86b9 100644
--- a/core/res/res/drawable-mdpi/ic_lockscreen_silent_activated.png
+++ b/core/res/res/drawable-mdpi/ic_lockscreen_silent_activated.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_soundon_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_soundon_activated.png
index 03f524dea92a..637eec6fb0cd 100644
--- a/core/res/res/drawable-mdpi/ic_lockscreen_soundon_activated.png
+++ b/core/res/res/drawable-mdpi/ic_lockscreen_soundon_activated.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_text_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_text_activated.png
index dbfc5babbc03..878ff1fea101 100644
--- a/core/res/res/drawable-mdpi/ic_lockscreen_text_activated.png
+++ b/core/res/res/drawable-mdpi/ic_lockscreen_text_activated.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_unlock_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_unlock_activated.png
index df479932ca8b..0d3f756cb99a 100644
--- a/core/res/res/drawable-mdpi/ic_lockscreen_unlock_activated.png
+++ b/core/res/res/drawable-mdpi/ic_lockscreen_unlock_activated.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_camera_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_camera_activated.png
new file mode 100644
index 000000000000..d54588336fdb
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/ic_lockscreen_camera_activated.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_camera_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_camera_normal.png
new file mode 100644
index 000000000000..8de7b8416db1
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/ic_lockscreen_camera_normal.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_silent_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_silent_activated.png
index fd812116d7f5..2900045963a8 100644
--- a/core/res/res/drawable-xhdpi/ic_lockscreen_silent_activated.png
+++ b/core/res/res/drawable-xhdpi/ic_lockscreen_silent_activated.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_soundon_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_soundon_activated.png
index 9edc70bc09af..da2adc2e50fc 100644
--- a/core/res/res/drawable-xhdpi/ic_lockscreen_soundon_activated.png
+++ b/core/res/res/drawable-xhdpi/ic_lockscreen_soundon_activated.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_text_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_text_activated.png
index 29c4572b5927..ddebe3ee7f74 100644
--- a/core/res/res/drawable-xhdpi/ic_lockscreen_text_activated.png
+++ b/core/res/res/drawable-xhdpi/ic_lockscreen_text_activated.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_unlock_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_unlock_activated.png
index fa0be9656ec3..73d7af3cd51b 100644
--- a/core/res/res/drawable-xhdpi/ic_lockscreen_unlock_activated.png
+++ b/core/res/res/drawable-xhdpi/ic_lockscreen_unlock_activated.png
Binary files differ
diff --git a/core/res/res/drawable/ic_lockscreen_camera.xml b/core/res/res/drawable/ic_lockscreen_camera.xml
new file mode 100644
index 000000000000..0e3ef37cfffb
--- /dev/null
+++ b/core/res/res/drawable/ic_lockscreen_camera.xml
@@ -0,0 +1,30 @@
+<?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" />
+
+</selector>
diff --git a/core/res/res/layout/keyguard_screen_tab_unlock.xml b/core/res/res/layout/keyguard_screen_tab_unlock.xml
index 05c768d19f88..6016d4e3dc6a 100644
--- a/core/res/res/layout/keyguard_screen_tab_unlock.xml
+++ b/core/res/res/layout/keyguard_screen_tab_unlock.xml
@@ -129,7 +129,7 @@
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
- android:targetDrawables="@array/lockscreen_targets_when_silent"
+ android:targetDrawables="@array/lockscreen_targets_with_camera"
android:handleDrawable="@drawable/ic_lockscreen_handle"
android:waveDrawable="@drawable/ic_lockscreen_outerring"
android:outerRadius="@dimen/multiwaveview_target_placement_radius"
diff --git a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
index 6440726eb84b..168bd1a3173e 100644
--- a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
+++ b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
@@ -131,7 +131,7 @@
android:layout_height="match_parent"
android:layout_rowSpan="7"
- android:targetDrawables="@array/lockscreen_targets_when_silent"
+ android:targetDrawables="@array/lockscreen_targets_with_camera"
android:handleDrawable="@drawable/ic_lockscreen_handle"
android:waveDrawable="@drawable/ic_lockscreen_outerring"
android:outerRadius="@dimen/multiwaveview_target_placement_radius"
diff --git a/core/res/res/values-land/arrays.xml b/core/res/res/values-land/arrays.xml
index 92d5a87d5c06..fd492ec081fe 100644
--- a/core/res/res/values-land/arrays.xml
+++ b/core/res/res/values-land/arrays.xml
@@ -34,4 +34,11 @@
<item>@drawable/ic_lockscreen_silent</item>
</array>
+ <array name="lockscreen_targets_with_camera">
+ <item>@null</item>
+ <item>@drawable/ic_lockscreen_unlock</item>
+ <item>@null</item>
+ <item>@drawable/ic_lockscreen_camera</item>
+ </array>
+
</resources>
diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml
index 73103a625ecc..fa9f1d1f6391 100644
--- a/core/res/res/values/arrays.xml
+++ b/core/res/res/values/arrays.xml
@@ -358,4 +358,11 @@
<item>@null</item>"
</array>
+ <array name="lockscreen_targets_with_camera">
+ <item>@drawable/ic_lockscreen_unlock</item>
+ <item>@null</item>
+ <item>@drawable/ic_lockscreen_camera</item>
+ <item>@null</item>"
+ </array>
+
</resources>
diff --git a/policy/src/com/android/internal/policy/impl/LockScreen.java b/policy/src/com/android/internal/policy/impl/LockScreen.java
index 4a14dd9aca47..9d360aca07cd 100644
--- a/policy/src/com/android/internal/policy/impl/LockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/LockScreen.java
@@ -23,7 +23,9 @@ import com.android.internal.widget.WaveView;
import com.android.internal.widget.multiwaveview.MultiWaveView;
import android.app.ActivityManager;
+import android.content.ActivityNotFoundException;
import android.content.Context;
+import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.view.KeyEvent;
@@ -181,14 +183,33 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
UnlockWidgetCommonMethods {
private final MultiWaveView mMultiWaveView;
+ private boolean mCameraDisabled;
MultiWaveViewMethods(MultiWaveView multiWaveView) {
mMultiWaveView = multiWaveView;
+ final boolean cameraDisabled = mLockPatternUtils.getDevicePolicyManager()
+ .getCameraDisabled(null);
+ if (cameraDisabled) {
+ Log.v(TAG, "Camera disabled by Device Policy");
+ mCameraDisabled = true;
+ } else {
+ // Camera is enabled if resource is initially defined for MultiWaveView
+ // in the lockscreen layout file
+ mCameraDisabled = mMultiWaveView.getTargetResourceId()
+ != R.array.lockscreen_targets_with_camera;
+ }
}
public void updateResources() {
- mMultiWaveView.setTargetResources(mSilentMode ? R.array.lockscreen_targets_when_silent
- : R.array.lockscreen_targets_when_soundon);
+ int resId;
+ if (mCameraDisabled) {
+ // Fall back to showing ring/silence if camera is disabled by DPM...
+ resId = mSilentMode ? R.array.lockscreen_targets_when_silent
+ : R.array.lockscreen_targets_when_soundon;
+ } else {
+ resId = R.array.lockscreen_targets_with_camera;
+ }
+ mMultiWaveView.setTargetResources(resId);
}
public void onGrabbed(View v, int handle) {
@@ -200,12 +221,19 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
}
public void onTrigger(View v, int target) {
- if (target == 0) { // TODO: Use resources to determine which handle was used
+ if (target == 0 || target == 1) { // 0 = unlock/portrait, 1 = unlock/landscape
mCallback.goToUnlockScreen();
- } else if (target == 2) {
- toggleRingMode();
- mUnlockWidgetMethods.updateResources();
- mCallback.pokeWakelock();
+ } else if (target == 2 || target == 3) { // 2 = alt/portrait, 3 = alt/landscape
+ if (!mCameraDisabled) {
+ // Broadcast an intent to start the Camera
+ Intent intent = new Intent(Intent.ACTION_CAMERA_BUTTON, null);
+ mContext.sendOrderedBroadcast(intent, null);
+ mCallback.goToUnlockScreen();
+ } else {
+ toggleRingMode();
+ mUnlockWidgetMethods.updateResources();
+ mCallback.pokeWakelock();
+ }
}
}