diff options
23 files changed, 304 insertions, 361 deletions
diff --git a/core/res/res/drawable-xhdpi/add_widget.png b/core/res/res/drawable-xhdpi/add_widget.png Binary files differnew file mode 100644 index 00000000000..9cf9b60e0c6 --- /dev/null +++ b/core/res/res/drawable-xhdpi/add_widget.png diff --git a/core/res/res/drawable-xhdpi/camera_widget.png b/core/res/res/drawable-xhdpi/camera_widget.png Binary files differnew file mode 100644 index 00000000000..02743885c52 --- /dev/null +++ b/core/res/res/drawable-xhdpi/camera_widget.png diff --git a/core/res/res/drawable-xhdpi/security_frame.9.png b/core/res/res/drawable-xhdpi/security_frame.9.png Binary files differnew file mode 100644 index 00000000000..9eeadc4d118 --- /dev/null +++ b/core/res/res/drawable-xhdpi/security_frame.9.png diff --git a/core/res/res/drawable-xhdpi/security_handle.png b/core/res/res/drawable-xhdpi/security_handle.png Binary files differnew file mode 100644 index 00000000000..bd4640f7228 --- /dev/null +++ b/core/res/res/drawable-xhdpi/security_handle.png diff --git a/core/res/res/layout-land/keyguard_host_view.xml b/core/res/res/layout-land/keyguard_host_view.xml deleted file mode 100644 index 521853f4174..00000000000 --- a/core/res/res/layout-land/keyguard_host_view.xml +++ /dev/null @@ -1,50 +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.internal.policy.impl.keyguard.KeyguardHostView - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/keyguard_host_view" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="center_vertical" - android:orientation="horizontal"> - - <include layout="@layout/keyguard_widget_region" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="@integer/kg_widget_region_weight" /> - - <com.android.internal.policy.impl.keyguard.KeyguardSecurityViewFlipper - android:id="@+id/view_flipper" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="@integer/kg_security_flipper_weight" - 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.internal.policy.impl.keyguard.KeyguardSecurityViewFlipper> - -</com.android.internal.policy.impl.keyguard.KeyguardHostView> diff --git a/core/res/res/layout-port/keyguard_host_view.xml b/core/res/res/layout-port/keyguard_host_view.xml index 981fe6d0da5..dc556ef9fb2 100644 --- a/core/res/res/layout-port/keyguard_host_view.xml +++ b/core/res/res/layout-port/keyguard_host_view.xml @@ -27,22 +27,45 @@ android:gravity="center_horizontal" android:orientation="vertical"> - <include layout="@layout/keyguard_widget_region" + <include layout="@layout/keyguard_widget_pager" android:layout_width="match_parent" - android:layout_height="153dp" /> + android:layout_height="match_parent" /> + + <SlidingDrawer + android:id="@+id/drawer" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + + android:handle="@+id/handle" + android:content="@+id/keyguard_security_container"> + + <ImageView + android:id="@id/handle" + android:layout_width="88dip" + android:layout_height="44dip" + android:src="@drawable/security_handle" /> + + <com.android.internal.policy.impl.keyguard.KeyguardSecurityContainer + android:id="@id/keyguard_security_container" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="bottom|center_horizontal" + android:background="@drawable/security_frame"> + <com.android.internal.policy.impl.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.internal.policy.impl.keyguard.KeyguardSecurityViewFlipper> + </com.android.internal.policy.impl.keyguard.KeyguardSecurityContainer> + + </SlidingDrawer> - <com.android.internal.policy.impl.keyguard.KeyguardSecurityViewFlipper - android:id="@+id/view_flipper" - android:layout_width="match_parent" - android:layout_height="0dip" - android:clipChildren="false" - android:clipToPadding="false" - android:layout_weight="1" - 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.internal.policy.impl.keyguard.KeyguardSecurityViewFlipper> </com.android.internal.policy.impl.keyguard.KeyguardHostView> diff --git a/core/res/res/layout-sw600dp-port/keyguard_host_view.xml b/core/res/res/layout-sw600dp-port/keyguard_host_view.xml deleted file mode 100644 index 23c1e9cb28a..00000000000 --- a/core/res/res/layout-sw600dp-port/keyguard_host_view.xml +++ /dev/null @@ -1,53 +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.internal.policy.impl.keyguard.KeyguardHostView - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/keyguard_host_view" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="center_horizontal" - android:orientation="vertical"> - - <include layout="@layout/keyguard_widget_region" - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="@integer/kg_widget_region_weight" /> - - <com.android.internal.policy.impl.keyguard.KeyguardSecurityViewFlipper - android:id="@+id/view_flipper" - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="@integer/kg_security_flipper_weight" - 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:layout_gravity="center"> - - - - </com.android.internal.policy.impl.keyguard.KeyguardSecurityViewFlipper> - -</com.android.internal.policy.impl.keyguard.KeyguardHostView> - diff --git a/core/res/res/layout/keyguard_add_widget.xml b/core/res/res/layout/keyguard_add_widget.xml new file mode 100644 index 00000000000..62f9906536a --- /dev/null +++ b/core/res/res/layout/keyguard_add_widget.xml @@ -0,0 +1,33 @@ +<?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.internal.policy.impl.keyguard.KeyguardWidgetFrame + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/keyguard_status_view" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center_horizontal"> + + <ImageView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:src="@drawable/add_widget" /> + +</com.android.internal.policy.impl.keyguard.KeyguardWidgetFrame> diff --git a/core/res/res/layout/keyguard_camera_widget.xml b/core/res/res/layout/keyguard_camera_widget.xml new file mode 100644 index 00000000000..a00dcd32421 --- /dev/null +++ b/core/res/res/layout/keyguard_camera_widget.xml @@ -0,0 +1,33 @@ +<?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.internal.policy.impl.keyguard.KeyguardWidgetFrame + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/keyguard_status_view" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center_horizontal"> + + <ImageView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:src="@drawable/camera_widget" /> + +</com.android.internal.policy.impl.keyguard.KeyguardWidgetFrame> diff --git a/core/res/res/layout/keyguard_widget_pager.xml b/core/res/res/layout/keyguard_widget_pager.xml new file mode 100644 index 00000000000..030da00ce7d --- /dev/null +++ b/core/res/res/layout/keyguard_widget_pager.xml @@ -0,0 +1,34 @@ +<?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.policy.impl.keyguard.KeyguardWidgetPager + xmlns:prvandroid="http://schemas.android.com/apk/res/com.android.lockhotness" + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/app_widget_container" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:paddingLeft="25dp" + android:paddingRight="25dp" + android:paddingTop="25dp" + android:paddingBottom="25dp" + android:clipChildren="false" + android:clipToPadding="false"> +</com.android.internal.policy.impl.keyguard.KeyguardWidgetPager> diff --git a/core/res/res/layout/keyguard_widget_region.xml b/core/res/res/layout/keyguard_widget_region.xml deleted file mode 100644 index ed10c2bdf6e..00000000000 --- a/core/res/res/layout/keyguard_widget_region.xml +++ /dev/null @@ -1,71 +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.policy.impl.keyguard.KeyguardWidgetRegion - xmlns:prvandroid="http://schemas.android.com/apk/prv/res/android" - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/kg_widget_region" - android:visibility="gone" - android:gravity="center" - android:orientation="vertical"> - <com.android.internal.policy.impl.keyguard.KeyguardWidgetPager - android:id="@+id/app_widget_container" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" - android:clipChildren="false" - android:clipToPadding="false"> - </com.android.internal.policy.impl.keyguard.KeyguardWidgetPager> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="10dp" - android:orientation="horizontal" - android:paddingLeft="@dimen/kg_widget_pager_horizontal_padding" - android:paddingRight="@dimen/kg_widget_pager_horizontal_padding" - android:layout_marginTop="@dimen/kg_runway_lights_top_margin" - android:visibility="gone"> - <com.android.internal.policy.impl.keyguard.KeyguardGlowStripView - android:id="@+id/left_strip" - android:paddingTop="@dimen/kg_runway_lights_vertical_padding" - android:paddingBottom="@dimen/kg_runway_lights_vertical_padding" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="1" - prvandroid:numDots="5" - prvandroid:dotSize="@dimen/kg_runway_lights_height" - prvandroid:leftToRight="false" - prvandroid:glowDot="@*android:drawable/ic_lockscreen_glowdot" /> - <Space - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="1.6"/> - <com.android.internal.policy.impl.keyguard.KeyguardGlowStripView - android:id="@+id/right_strip" - android:paddingTop="@dimen/kg_runway_lights_vertical_padding" - android:paddingBottom="@dimen/kg_runway_lights_vertical_padding" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="1" - prvandroid:numDots="5" - prvandroid:dotSize="@dimen/kg_runway_lights_height" - prvandroid:leftToRight="true" - prvandroid:glowDot="@*android:drawable/ic_lockscreen_glowdot" /> - </LinearLayout> -</com.android.internal.policy.impl.keyguard.KeyguardWidgetRegion> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 8ef91df1853..d9ce60891f5 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1086,8 +1086,9 @@ <java-symbol type="layout" name="notification_template_inbox" /> <java-symbol type="layout" name="keyguard_multi_user_avatar" /> <java-symbol type="layout" name="keyguard_multi_user_selector_widget" /> - <java-symbol type="layout" name="keyguard_widget_region" /> <java-symbol type="layout" name="sms_short_code_confirmation_dialog" /> + <java-symbol type="layout" name="keyguard_add_widget" /> + <java-symbol type="layout" name="keyguard_camera_widget" /> <java-symbol type="anim" name="slide_in_child_bottom" /> <java-symbol type="anim" name="slide_in_right" /> @@ -1192,7 +1193,7 @@ <java-symbol type="bool" name="config_reverseDefaultRotation" /> <java-symbol type="bool" name="config_showNavigationBar" /> <java-symbol type="bool" name="kg_share_status_area" /> - <java-symbol type="bool" name="kg_sim_puk_account_full_screen" /> + <java-symbol type="bool" name="kg_sim_puk_account_full_screen" /> <java-symbol type="bool" name="target_honeycomb_needs_options_menu" /> <java-symbol type="color" name="kg_multi_user_text_active" /> <java-symbol type="color" name="kg_multi_user_text_inactive" /> @@ -1304,9 +1305,6 @@ <java-symbol type="id" name="keyguard_users_grid" /> <java-symbol type="id" name="clock_text" /> <java-symbol type="id" name="clock_view" /> - <java-symbol type="id" name="kg_widget_region" /> - <java-symbol type="id" name="left_strip" /> - <java-symbol type="id" name="right_strip" /> <java-symbol type="id" name="keyguard_multi_user_selector" /> <java-symbol type="id" name="status_security_message" /> diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java index b86e5b8564c..d72c43fad3a 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java @@ -71,7 +71,6 @@ public class KeyguardHostView extends KeyguardViewBase { private static final int TRANSPORT_VISIBLE = 2; private AppWidgetHost mAppWidgetHost; - private KeyguardWidgetRegion mAppWidgetRegion; private KeyguardWidgetPager mAppWidgetContainer; private ViewFlipper mSecurityViewContainer; private KeyguardSelectorView mKeyguardSelectorView; @@ -151,11 +150,10 @@ public class KeyguardHostView extends KeyguardViewBase { @Override protected void onFinishInflate() { - mAppWidgetRegion = (KeyguardWidgetRegion) findViewById(R.id.kg_widget_region); - mAppWidgetRegion.setVisibility(VISIBLE); - mAppWidgetRegion.setCallbacks(mWidgetCallbacks); - mAppWidgetContainer = (KeyguardWidgetPager) findViewById(R.id.app_widget_container); + mAppWidgetContainer.setVisibility(VISIBLE); + mAppWidgetContainer.setCallbacks(mWidgetCallbacks); + mSecurityViewContainer = (ViewFlipper) findViewById(R.id.view_flipper); mKeyguardSelectorView = (KeyguardSelectorView) findViewById(R.id.keyguard_selector_view); @@ -196,7 +194,7 @@ public class KeyguardHostView extends KeyguardViewBase { super.onAttachedToWindow(); mAppWidgetHost.startListening(); // TODO: Re-enable when we have layouts that can support a better variety of widgets. - // maybePopulateWidgets(); + maybePopulateWidgets(); disableStatusViewInteraction(); post(mSwitchPageRunnable); } @@ -225,8 +223,8 @@ public class KeyguardHostView extends KeyguardViewBase { mAppWidgetContainer.addWidget(view); } - private KeyguardWidgetRegion.Callbacks mWidgetCallbacks - = new KeyguardWidgetRegion.Callbacks() { + private KeyguardWidgetPager.Callbacks mWidgetCallbacks + = new KeyguardWidgetPager.Callbacks() { @Override public void userActivity() { if (mViewMediatorCallback != null) { @@ -246,8 +244,8 @@ public class KeyguardHostView extends KeyguardViewBase { public long getUserActivityTimeout() { // Currently only considering user activity timeouts needed by widgets. // Could also take into account longer timeouts for certain security views. - if (mAppWidgetRegion != null) { - return mAppWidgetRegion.getUserActivityTimeout(); + if (mAppWidgetContainer != null) { + return mAppWidgetContainer.getUserActivityTimeout(); } return -1; } @@ -607,7 +605,8 @@ public class KeyguardHostView extends KeyguardViewBase { break; } } - boolean simPukFullScreen = getResources().getBoolean(R.bool.kg_sim_puk_account_full_screen); + boolean simPukFullScreen = getResources().getBoolean( + com.android.internal.R.bool.kg_sim_puk_account_full_screen); int layoutId = getLayoutIdFor(securityMode); if (view == null && layoutId != 0) { final LayoutInflater inflater = LayoutInflater.from(mContext); @@ -631,7 +630,7 @@ public class KeyguardHostView extends KeyguardViewBase { if (securityMode == SecurityMode.SimPin || securityMode == SecurityMode.SimPuk || securityMode == SecurityMode.Account) { if (simPukFullScreen) { - mAppWidgetRegion.setVisibility(View.GONE); + mAppWidgetContainer.setVisibility(View.GONE); } } @@ -812,9 +811,12 @@ public class KeyguardHostView extends KeyguardViewBase { private void addDefaultWidgets() { LayoutInflater inflater = LayoutInflater.from(mContext); - inflater.inflate(R.layout.keyguard_status_view, mAppWidgetContainer, true); inflater.inflate(R.layout.keyguard_transport_control_view, this, true); + inflater.inflate(R.layout.keyguard_add_widget, mAppWidgetContainer, true); + inflater.inflate(R.layout.keyguard_status_view, mAppWidgetContainer, true); + inflater.inflate(R.layout.keyguard_camera_widget, mAppWidgetContainer, true); + inflateAndAddUserSelectorWidgetIfNecessary(); initializeTransportControl(); } @@ -892,7 +894,9 @@ public class KeyguardHostView extends KeyguardViewBase { // Add user-selected widget final int[] widgets = mLockPatternUtils.getUserDefinedWidgets(); + System.out.println("Num widgets: " + widgets.length); for (int i = 0; i < widgets.length; i++) { + System.out.println(" widget: " + widgets[i]); if (widgets[i] != -1) { addWidget(widgets[i]); } diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardMultiUserAvatar.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardMultiUserAvatar.java index 3c972bc40d4..79b35d4c374 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardMultiUserAvatar.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardMultiUserAvatar.java @@ -73,8 +73,8 @@ class KeyguardMultiUserAvatar extends FrameLayout { super(context, attrs, defStyle); Resources res = mContext.getResources(); - mActiveTextColor = res.getColor(R.color.kg_multi_user_text_active); - mInactiveTextColor = res.getColor(R.color.kg_multi_user_text_inactive); + mActiveTextColor = res.getColor(com.android.internal.R.color.kg_multi_user_text_active); + mInactiveTextColor = res.getColor(com.android.internal.R.color.kg_multi_user_text_inactive); } public void init(UserInfo user, KeyguardMultiUserSelectorView userSelector) { diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityContainer.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityContainer.java new file mode 100644 index 00000000000..f6a90c5941b --- /dev/null +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityContainer.java @@ -0,0 +1,20 @@ +package com.android.internal.policy.impl.keyguard; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.FrameLayout; + +public class KeyguardSecurityContainer extends FrameLayout { + + public KeyguardSecurityContainer(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public KeyguardSecurityContainer(Context context) { + this(null, null, 0); + } + + public KeyguardSecurityContainer(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } +} diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSimPukView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSimPukView.java index 562d8931e2a..320cdc8c597 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSimPukView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSimPukView.java @@ -91,7 +91,8 @@ public class KeyguardSimPukView extends LinearLayout implements View.OnClickList } else if (state == CONFIRM_PIN) { if (confirmPin()) { state = DONE; - msg = R.string.lockscreen_sim_unlock_progress_dialog_message; + msg = + com.android.internal.R.string.lockscreen_sim_unlock_progress_dialog_message; updateSim(); } else { msg = R.string.kg_invalid_confirm_pin_hint; diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusViewManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusViewManager.java index 5b85064fdab..b6985bdc815 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusViewManager.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusViewManager.java @@ -78,7 +78,7 @@ class KeyguardStatusViewManager implements SecurityMessageDisplay { // Whether to use the last line as a combined line to either display owner info / charging. // If false, each item will be given a dedicated space. private boolean mShareStatusRegion = false; - + // last known battery level private int mBatteryLevel = 100; @@ -121,9 +121,9 @@ class KeyguardStatusViewManager implements SecurityMessageDisplay { if (DEBUG) Log.v(TAG, "KeyguardStatusViewManager()"); mContainer = view; Resources res = getContext().getResources(); - mDateFormatString = + mDateFormatString = res.getText(com.android.internal.R.string.abbrev_wday_month_day_no_year); - mShareStatusRegion = res.getBoolean(R.bool.kg_share_status_area); + mShareStatusRegion = res.getBoolean(com.android.internal.R.bool.kg_share_status_area); mLockPatternUtils = new LockPatternUtils(view.getContext()); mUpdateMonitor = KeyguardUpdateMonitor.getInstance(view.getContext()); diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewBase.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewBase.java index 3191f4a1df2..664424ec0e6 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewBase.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewBase.java @@ -27,11 +27,11 @@ import android.media.IAudioService; import android.os.RemoteException; import android.os.ServiceManager; import android.telephony.TelephonyManager; -import android.view.KeyEvent; -import android.widget.LinearLayout; import android.util.AttributeSet; import android.util.Log; import android.util.Slog; +import android.view.KeyEvent; +import android.widget.FrameLayout; /** * Base class for keyguard view. {@link #reset} is where you should @@ -42,7 +42,7 @@ import android.util.Slog; * Handles intercepting of media keys that still work when the keyguard is * showing. */ -public abstract class KeyguardViewBase extends LinearLayout { +public abstract class KeyguardViewBase extends FrameLayout { private static final int BACKGROUND_COLOR = 0x70000000; private AudioManager mAudioManager; diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java index 311eec68bc5..749c440f06f 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java @@ -19,7 +19,6 @@ package com.android.internal.policy.impl.keyguard; import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; -import android.graphics.Color; import android.graphics.LinearGradient; import android.graphics.Paint; import android.graphics.PorterDuff; @@ -64,11 +63,14 @@ public class KeyguardWidgetFrame extends FrameLayout { mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); + Resources res = context.getResources(); + /* int hPadding = res.getDimensionPixelSize(R.dimen.kg_widget_pager_horizontal_padding); int topPadding = res.getDimensionPixelSize(R.dimen.kg_widget_pager_top_padding); int bottomPadding = res.getDimensionPixelSize(R.dimen.kg_widget_pager_bottom_padding); setPadding(hPadding, topPadding, hPadding, bottomPadding); + */ mGradientColor = res.getColor(com.android.internal.R.color.kg_widget_pager_gradient); mGradientPaint.setXfermode(sAddBlendMode); } diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java index 1e65665b2af..dd37cb77046 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java @@ -22,6 +22,7 @@ import android.util.AttributeSet; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; +import android.view.ViewGroup; import android.view.animation.AccelerateInterpolator; import android.view.animation.DecelerateInterpolator; @@ -29,7 +30,7 @@ import android.widget.FrameLayout; import com.android.internal.R; -public class KeyguardWidgetPager extends PagedView { +public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwitchListener { ZInterpolator mZInterpolator = new ZInterpolator(0.5f); private static float CAMERA_DISTANCE = 10000; private static float TRANSITION_SCALE_FACTOR = 0.74f; @@ -39,6 +40,12 @@ public class KeyguardWidgetPager extends PagedView { private AccelerateInterpolator mAlphaInterpolator = new AccelerateInterpolator(0.9f); private DecelerateInterpolator mLeftScreenAlphaInterpolator = new DecelerateInterpolator(4); + private static final long CUSTOM_WIDGET_USER_ACTIVITY_TIMEOUT = 30000; + private static final boolean CAFETERIA_TRAY = false; + + private int mPage = 0; + private Callbacks mCallbacks; + public KeyguardWidgetPager(Context context, AttributeSet attrs) { this(context, attrs, 0); } @@ -52,8 +59,63 @@ public class KeyguardWidgetPager extends PagedView { if (getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) { setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); } + + setPageSwitchListener(this); + } + + @Override + public void onPageSwitch(View newPage, int newPageIndex) { + boolean showingStatusWidget = false; + if (newPage instanceof ViewGroup) { + ViewGroup vg = (ViewGroup) newPage; + if (vg.getChildAt(0) instanceof KeyguardStatusView) { + showingStatusWidget = true; + } + } + + // Disable the status bar clock if we're showing the default status widget + if (showingStatusWidget) { + 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) { + mPage = newPageIndex; + if (mCallbacks != null) { + mCallbacks.onUserActivityTimeoutChanged(); + mCallbacks.userActivity(); + } + } } + 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(); + } + /* * We wrap widgets in a special frame which handles drawing the overscroll foreground. */ @@ -71,9 +133,7 @@ public class KeyguardWidgetPager extends PagedView { } protected void onUnhandledTap(MotionEvent ev) { - if (getParent() instanceof KeyguardWidgetRegion) { - ((KeyguardWidgetRegion) getParent()).showPagingFeedback(); - } + showPagingFeedback(); } @Override @@ -144,21 +204,24 @@ public class KeyguardWidgetPager extends PagedView { View v = getPageAt(i); if (v != null) { float scrollProgress = getScrollProgress(screenCenter, v, i); - - float interpolatedProgress = + float interpolatedProgress = mZInterpolator.getInterpolation(Math.abs(Math.min(scrollProgress, 0))); - float scale = (1 - interpolatedProgress) + - interpolatedProgress * TRANSITION_SCALE_FACTOR; - float translationX = Math.min(0, scrollProgress) * v.getMeasuredWidth(); - - float alpha; - - if (scrollProgress < 0) { - alpha = scrollProgress < 0 ? mAlphaInterpolator.getInterpolation( - 1 - Math.abs(scrollProgress)) : 1.0f; - } else { - // On large screens we need to fade the page as it nears its leftmost position - alpha = mLeftScreenAlphaInterpolator.getInterpolation(1 - scrollProgress); + float scale = 1.0f; + float translationX = 0; + float alpha = 1.0f; + + if (CAFETERIA_TRAY) { + scale = (1 - interpolatedProgress) + + interpolatedProgress * TRANSITION_SCALE_FACTOR; + translationX = Math.min(0, scrollProgress) * v.getMeasuredWidth(); + + if (scrollProgress < 0) { + alpha = scrollProgress < 0 ? mAlphaInterpolator.getInterpolation( + 1 - Math.abs(scrollProgress)) : 1.0f; + } else { + // On large screens we need to fade the page as it nears its leftmost position + alpha = mLeftScreenAlphaInterpolator.getInterpolation(1 - scrollProgress); + } } v.setCameraDistance(mDensity * CAMERA_DISTANCE); diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetRegion.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetRegion.java deleted file mode 100644 index 4ff6f27302c..00000000000 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetRegion.java +++ /dev/null @@ -1,125 +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.internal.policy.impl.keyguard; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.View; -import android.view.ViewGroup; -import android.widget.LinearLayout; - -import com.android.internal.R; -public class KeyguardWidgetRegion extends LinearLayout implements PagedView.PageSwitchListener { - KeyguardGlowStripView mLeftStrip; - KeyguardGlowStripView mRightStrip; - KeyguardWidgetPager mPager; - private int mPage = 0; - private Callbacks mCallbacks; - - // We are disabling touch interaction of the widget region for factory ROM. - private static final boolean DISABLE_TOUCH_INTERACTION = true; - - private static final long CUSTOM_WIDGET_USER_ACTIVITY_TIMEOUT = 30000; - - public KeyguardWidgetRegion(Context context) { - this(context, null, 0); - } - - public KeyguardWidgetRegion(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public KeyguardWidgetRegion(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - protected void onFinishInflate() { - super.onFinishInflate(); - mLeftStrip = (KeyguardGlowStripView) findViewById(R.id.left_strip); - mRightStrip = (KeyguardGlowStripView) findViewById(R.id.right_strip); - mPager = (KeyguardWidgetPager) findViewById(R.id.app_widget_container); - mPager.setPageSwitchListener(this); - - setSoundEffectsEnabled(false); - if (!DISABLE_TOUCH_INTERACTION) { - setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - showPagingFeedback(); - } - }); - } - } - - public void showPagingFeedback() { - if ((mPage < mPager.getPageCount() - 1)) { - mLeftStrip.makeEmGo(); - } - if ((mPage > 0)) { - mRightStrip.makeEmGo(); - } - } - - @Override - public void onPageSwitch(View newPage, int newPageIndex) { - boolean showingStatusWidget = false; - if (newPage instanceof ViewGroup) { - ViewGroup vg = (ViewGroup) newPage; - if (vg.getChildAt(0) instanceof KeyguardStatusView) { - showingStatusWidget = true; - } - } - - // Disable the status bar clock if we're showing the default status widget - if (showingStatusWidget) { - 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) { - mPage = newPageIndex; - if (mCallbacks != null) { - mCallbacks.onUserActivityTimeoutChanged(); - mCallbacks.userActivity(); - } - } - } - - public long getUserActivityTimeout() { - View page = mPager.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(); - } -} diff --git a/policy/src/com/android/internal/policy/impl/keyguard/PagedView.java b/policy/src/com/android/internal/policy/impl/keyguard/PagedView.java index 86c05b196e3..c8772199b94 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/PagedView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/PagedView.java @@ -78,7 +78,7 @@ public class PagedView extends ViewGroup implements ViewGroup.OnHierarchyChangeL private static final int MIN_FLING_VELOCITY = 250; // We are disabling touch interaction of the widget region for factory ROM. - private static final boolean DISABLE_TOUCH_INTERACTION = true; + private static final boolean DISABLE_TOUCH_INTERACTION = false; static final int AUTOMATIC_PAGE_SPACING = -1; diff --git a/policy/src/com/android/internal/policy/impl/keyguard/SecureCamera.java b/policy/src/com/android/internal/policy/impl/keyguard/SecureCamera.java new file mode 100644 index 00000000000..505917eac23 --- /dev/null +++ b/policy/src/com/android/internal/policy/impl/keyguard/SecureCamera.java @@ -0,0 +1,31 @@ +/* + * 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.internal.policy.impl.keyguard; + +import android.app.Activity; +import android.os.Bundle; +import android.widget.FrameLayout; + +public class SecureCamera extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(new FrameLayout(this)); + } + +} |