Merge "Adding user activity when the challenge is slid down" into jb-mr1-lockscreen-dev
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index fdaf39e..0fe2a8e 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -1,16 +1,16 @@
/*
** 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
+** 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
+** 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
+** 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.
*/
@@ -107,7 +107,7 @@
Configuration updateOrientationFromAppTokens(in Configuration currentConfig,
IBinder freezeThisOneIfNeeded);
void setNewConfiguration(in Configuration config);
-
+
void startFreezingScreen(int exitAnim, int enterAnim);
void stopFreezingScreen();
@@ -121,13 +121,13 @@
void dismissKeyguard();
void closeSystemDialogs(String reason);
-
+
// These can only be called with the SET_ANIMATON_SCALE permission.
float getAnimationScale(int which);
float[] getAnimationScales();
void setAnimationScale(int which, float scale);
void setAnimationScales(in float[] scales);
-
+
// For testing
void setInTouchMode(boolean showFocus);
@@ -161,7 +161,7 @@
* {@link android.view.Surface}.
*/
int getRotation();
-
+
/**
* Watch the rotation of the screen. Returns the current rotation,
* calls back when it changes.
@@ -175,24 +175,24 @@
*/
int getPreferredOptionsPanelGravity();
- /**
- * Lock the device orientation to the specified rotation, or to the
- * current rotation if -1. Sensor input will be ignored until
- * thawRotation() is called.
- * @hide
- */
- void freezeRotation(int rotation);
+ /**
+ * Lock the device orientation to the specified rotation, or to the
+ * current rotation if -1. Sensor input will be ignored until
+ * thawRotation() is called.
+ * @hide
+ */
+ void freezeRotation(int rotation);
- /**
- * Release the orientation lock imposed by freezeRotation().
- * @hide
- */
- void thawRotation();
+ /**
+ * Release the orientation lock imposed by freezeRotation().
+ * @hide
+ */
+ void thawRotation();
- /**
- * Create a screenshot of the applications currently displayed.
- */
- Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight);
+ /**
+ * Create a screenshot of the applications currently displayed.
+ */
+ Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight);
/**
* Called by the status bar to notify Views of changes to System UI visiblity.
@@ -259,4 +259,10 @@
* Device is in safe mode.
*/
boolean isSafeModeEnabled();
+
+ /**
+ * Tell keyguard to show the assistant (Intent.ACTION_ASSIST) after asking for the user's
+ * credentials.
+ */
+ void showAssistant();
}
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index 4ccb502..26739b3 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -1136,4 +1136,10 @@
* @param args additional arguments to the dump request.
*/
public void dump(String prefix, PrintWriter writer, String[] args);
+
+ /**
+ * Ask keyguard to invoke the assist intent after dismissing keyguard
+ * {@link android.content.Intent#ACTION_ASSIST}
+ */
+ public void showAssistant();
}
diff --git a/core/res/res/anim/keyguard_action_assist_enter.xml b/core/res/res/anim/keyguard_action_assist_enter.xml
new file mode 100644
index 0000000..f3333b7
--- /dev/null
+++ b/core/res/res/anim/keyguard_action_assist_enter.xml
@@ -0,0 +1,32 @@
+<?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/core/res/res/anim/keyguard_action_assist_exit.xml b/core/res/res/anim/keyguard_action_assist_exit.xml
new file mode 100644
index 0000000..b4ed278
--- /dev/null
+++ b/core/res/res/anim/keyguard_action_assist_exit.xml
@@ -0,0 +1,23 @@
+<?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/core/res/res/layout/keyguard_account_view.xml b/core/res/res/layout/keyguard_account_view.xml
index 8bc1da2..fa36371 100644
--- a/core/res/res/layout/keyguard_account_view.xml
+++ b/core/res/res/layout/keyguard_account_view.xml
@@ -75,7 +75,7 @@
</RelativeLayout>
<!-- no room for ECA on this screen right now
- <include layout="@layout/keyguard_emergency_carrier_area"
+ <include layout="@layout/keyguard_eca"
android:id="@+id/keyguard_selector_fade_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/core/res/res/layout/keyguard_emergency_carrier_area_empty.xml b/core/res/res/layout/keyguard_emergency_carrier_area_empty.xml
new file mode 100644
index 0000000..2f4adae
--- /dev/null
+++ b/core/res/res/layout/keyguard_emergency_carrier_area_empty.xml
@@ -0,0 +1,31 @@
+<?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 a blank layout to simplify implementation on landscape on phones
+ it is referenced indirectly by keyguard_eca -->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="0dip"
+ android:layout_height="0dip"
+ android:orientation="vertical"
+ android:gravity="center"
+ android:layout_gravity="center_horizontal"
+ android:layout_alignParentBottom="true">
+
+</LinearLayout>
diff --git a/core/res/res/layout/keyguard_face_unlock_view.xml b/core/res/res/layout/keyguard_face_unlock_view.xml
index 12b6052..c9f1176 100644
--- a/core/res/res/layout/keyguard_face_unlock_view.xml
+++ b/core/res/res/layout/keyguard_face_unlock_view.xml
@@ -68,7 +68,7 @@
</com.android.internal.widget.FaceUnlockView>
</FrameLayout>
- <include layout="@layout/keyguard_emergency_carrier_area"
+ <include layout="@layout/keyguard_eca"
android:id="@+id/keyguard_selector_fade_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/core/res/res/layout/keyguard_password_view.xml b/core/res/res/layout/keyguard_password_view.xml
index b9a0553..aab54c3 100644
--- a/core/res/res/layout/keyguard_password_view.xml
+++ b/core/res/res/layout/keyguard_password_view.xml
@@ -93,7 +93,7 @@
android:layout_weight="1"
/>
- <include layout="@layout/keyguard_emergency_carrier_area"
+ <include layout="@layout/keyguard_eca"
android:id="@+id/keyguard_selector_fade_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/core/res/res/layout/keyguard_pattern_view.xml b/core/res/res/layout/keyguard_pattern_view.xml
index 7eb7698..8d0d3f9 100644
--- a/core/res/res/layout/keyguard_pattern_view.xml
+++ b/core/res/res/layout/keyguard_pattern_view.xml
@@ -64,7 +64,7 @@
android:gravity="center"
android:contentDescription="@string/keyguard_accessibility_pattern_area" />
</FrameLayout>
- <include layout="@layout/keyguard_emergency_carrier_area"
+ <include layout="@layout/keyguard_eca"
android:id="@+id/keyguard_selector_fade_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/core/res/res/layout/keyguard_pin_view.xml b/core/res/res/layout/keyguard_pin_view.xml
index 5c26a53..e494b69 100644
--- a/core/res/res/layout/keyguard_pin_view.xml
+++ b/core/res/res/layout/keyguard_pin_view.xml
@@ -212,7 +212,7 @@
/>
</LinearLayout>
</LinearLayout>
- <include layout="@layout/keyguard_emergency_carrier_area"
+ <include layout="@layout/keyguard_eca"
android:id="@+id/keyguard_selector_fade_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/core/res/res/layout/keyguard_selector_view.xml b/core/res/res/layout/keyguard_selector_view.xml
index 124bfc9..dfacb6a 100644
--- a/core/res/res/layout/keyguard_selector_view.xml
+++ b/core/res/res/layout/keyguard_selector_view.xml
@@ -53,7 +53,7 @@
<include layout="@layout/keyguard_glow_pad_container" />
- <include layout="@layout/keyguard_emergency_carrier_area"
+ <include layout="@layout/keyguard_eca"
android:id="@+id/keyguard_selector_fade_container"
android:layout_width="match_parent"
android:layout_height="48dp"
diff --git a/core/res/res/layout/keyguard_sim_pin_view.xml b/core/res/res/layout/keyguard_sim_pin_view.xml
index 1c9c81e..026b025 100644
--- a/core/res/res/layout/keyguard_sim_pin_view.xml
+++ b/core/res/res/layout/keyguard_sim_pin_view.xml
@@ -218,7 +218,7 @@
</LinearLayout>
</LinearLayout>
- <include layout="@layout/keyguard_emergency_carrier_area"
+ <include layout="@layout/keyguard_eca"
android:id="@+id/keyguard_selector_fade_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/core/res/res/layout/keyguard_sim_puk_view.xml b/core/res/res/layout/keyguard_sim_puk_view.xml
index 06bd014..28a9f9a 100644
--- a/core/res/res/layout/keyguard_sim_puk_view.xml
+++ b/core/res/res/layout/keyguard_sim_puk_view.xml
@@ -219,7 +219,7 @@
</LinearLayout>
</LinearLayout>
- <include layout="@layout/keyguard_emergency_carrier_area"
+ <include layout="@layout/keyguard_eca"
android:id="@+id/keyguard_selector_fade_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/core/res/res/values-land/alias.xml b/core/res/res/values-land/alias.xml
new file mode 100644
index 0000000..eac5ece
--- /dev/null
+++ b/core/res/res/values-land/alias.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/colors.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>
+ <!-- Alias used to reference one of two possible layouts in keyguard. -->
+ <item type="layout" name="keyguard_eca">@android:layout/keyguard_emergency_carrier_area_empty</item>
+</resources>
diff --git a/core/res/res/values-port/alias.xml b/core/res/res/values-port/alias.xml
new file mode 100644
index 0000000..bf3eecb
--- /dev/null
+++ b/core/res/res/values-port/alias.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/colors.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>
+ <!-- Alias used to reference one of two possible layouts in keyguard. -->
+ <item type="layout" name="keyguard_eca">@android:layout/keyguard_emergency_carrier_area</item>
+</resources>
diff --git a/core/res/res/values-sw600dp/alias.xml b/core/res/res/values-sw600dp/alias.xml
new file mode 100644
index 0000000..bf3eecb
--- /dev/null
+++ b/core/res/res/values-sw600dp/alias.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/colors.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>
+ <!-- Alias used to reference one of two possible layouts in keyguard. -->
+ <item type="layout" name="keyguard_eca">@android:layout/keyguard_emergency_carrier_area</item>
+</resources>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 10a8b1b..68a0289 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1189,6 +1189,9 @@
<java-symbol type="anim" name="keyguard_security_animate_out" />
<java-symbol type="anim" name="keyguard_security_fade_in" />
<java-symbol type="anim" name="keyguard_security_fade_out" />
+ <java-symbol type="anim" name="keyguard_action_assist_exit" />
+ <java-symbol type="anim" name="keyguard_action_assist_enter" />
+
<java-symbol type="array" name="config_keyboardTapVibePattern" />
<java-symbol type="array" name="config_longPressVibePattern" />
<java-symbol type="array" name="config_safeModeDisabledVibePattern" />
diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
index 4b0e818..76613e0 100644
--- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
@@ -26,11 +26,13 @@
import android.content.Intent;
import android.content.res.Resources;
import android.os.RemoteException;
+import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.Vibrator;
import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Slog;
+import android.view.IWindowManager;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -62,6 +64,7 @@
private boolean mShowing;
private View mSearchTargetsContainer;
private GlowPadView mGlowPadView;
+ private IWindowManager mWm;
public SearchPanelView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
@@ -70,6 +73,7 @@
public SearchPanelView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mContext = context;
+ mWm = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
}
private void startAssistActivity() {
@@ -77,28 +81,13 @@
// Close Recent Apps if needed
mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL);
- // Launch Assist
- Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
- .getAssistIntent(mContext, UserHandle.USER_CURRENT);
- if (intent == null) return;
- // Dismiss the keyguard if possible. XXX: TODO: invoke bouncer.
try {
- ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity();
+ mWm.showAssistant();
} catch (RemoteException e) {
+ // too bad, so sad...
}
-
- try {
- ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext,
- R.anim.search_launch_enter, R.anim.search_launch_exit,
- getHandler(), this);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- mContext.startActivityAsUser(intent, opts.toBundle(),
- new UserHandle(UserHandle.USER_CURRENT));
- } catch (ActivityNotFoundException e) {
- Slog.w(TAG, "Activity not found for " + intent.getAction());
- onAnimationStarted();
- }
+ onAnimationStarted();
}
class GlowPadTriggerListener implements GlowPadView.OnTriggerListener {
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 54bf20d..d9c07f8 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -4540,6 +4540,11 @@
}
@Override
+ public void showAssistant() {
+ mKeyguardMediator.showAssistant();
+ }
+
+ @Override
public void dump(String prefix, PrintWriter pw, String[] args) {
pw.print(prefix); pw.print("mSafeMode="); pw.print(mSafeMode);
pw.print(" mSystemReady="); pw.print(mSystemReady);
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 5fa282d..8487f02 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
@@ -20,11 +20,13 @@
import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.AlertDialog;
+import android.app.SearchManager;
import android.app.admin.DevicePolicyManager;
import android.appwidget.AppWidgetHost;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
+import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -37,6 +39,7 @@
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
+import android.os.UserHandle;
import android.os.UserManager;
import android.util.AttributeSet;
import android.util.Log;
@@ -156,6 +159,8 @@
}
};
+ private SlidingChallengeLayout mSlidingChallengeLayout;
+
@Override
public boolean onTouchEvent(MotionEvent ev) {
boolean result = super.onTouchEvent(ev);
@@ -196,15 +201,14 @@
mAppWidgetContainer.setDeleteDropTarget(deleteDropTarget);
mAppWidgetContainer.setMinScale(0.5f);
- SlidingChallengeLayout slider =
- (SlidingChallengeLayout) findViewById(R.id.sliding_layout);
- if (slider != null) {
- slider.setOnChallengeScrolledListener(mViewStateManager);
+ mSlidingChallengeLayout = (SlidingChallengeLayout) findViewById(R.id.sliding_layout);
+ if (mSlidingChallengeLayout != null) {
+ mSlidingChallengeLayout.setOnChallengeScrolledListener(mViewStateManager);
}
mAppWidgetContainer.setViewStateManager(mViewStateManager);
mAppWidgetContainer.setLockPatternUtils(mLockPatternUtils);
- ChallengeLayout challenge = slider != null ? slider :
+ ChallengeLayout challenge = mSlidingChallengeLayout != null ? mSlidingChallengeLayout :
(ChallengeLayout) findViewById(R.id.multi_pane_challenge);
challenge.setOnBouncerStateChangedListener(mViewStateManager);
mAppWidgetContainer.setBouncerAnimationDuration(challenge.getBouncerAnimationDuration());
@@ -741,6 +745,10 @@
mAppWidgetContainer.setVisibility(
isSimOrAccount && fullScreenEnabled ? View.GONE : View.VISIBLE);
+ if (mSlidingChallengeLayout != null) {
+ mSlidingChallengeLayout.setChallengeInteractive(!fullScreenEnabled);
+ }
+
// Emulate Activity life cycle
if (oldView != null) {
oldView.onPause();
@@ -1445,4 +1453,31 @@
public void dismiss() {
showNextSecurityScreenOrFinish(false);
}
+
+ public void showAssistant() {
+ final Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
+ .getAssistIntent(mContext, 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);
+ setOnDismissAction(new OnDismissAction() {
+ @Override
+ public boolean onDismiss() {
+ try {
+ mContext.startActivityAsUser(intent, opts.toBundle(),
+ new UserHandle(UserHandle.USER_CURRENT));
+ } catch (ActivityNotFoundException e) {
+ Slog.w(TAG, "Activity not found for " + intent.getAction());
+ }
+ return false;
+ }
+ });
+
+ mViewStateManager.showBouncer(true);
+ }
}
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
index 365c530..c81ff55 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
@@ -168,6 +168,7 @@
int flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
+ | WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
| WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
if (!mNeedsInput) {
@@ -424,4 +425,10 @@
public synchronized boolean isShowing() {
return (mKeyguardHost != null && mKeyguardHost.getVisibility() == View.VISIBLE);
}
+
+ public void showAssistant() {
+ if (mKeyguardView != null) {
+ mKeyguardView.showAssistant();
+ }
+ }
}
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
index 128930a..23c642d 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
@@ -116,6 +116,7 @@
private static final int KEYGUARD_DONE_AUTHENTICATING = 11;
private static final int SET_HIDDEN = 12;
private static final int KEYGUARD_TIMEOUT = 13;
+ private static final int SHOW_ASSISTANT = 14;
/**
* The default amount of time we stay awake (used for all key input)
@@ -1130,6 +1131,9 @@
doKeyguardLocked((Bundle) msg.obj);
}
break;
+ case SHOW_ASSISTANT:
+ handleShowAssistant();
+ break;
}
}
};
@@ -1393,4 +1397,13 @@
return mKeyguardDonePending || !isSecure();
}
+ public void showAssistant() {
+ Message msg = mHandler.obtainMessage(SHOW_ASSISTANT);
+ mHandler.sendMessage(msg);
+ }
+
+ public void handleShowAssistant() {
+ mKeyguardViewManager.showAssistant();
+ }
+
}
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
index 339e03f..0a166e1 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
@@ -120,6 +120,7 @@
// once the user swipes a page we clear that behavior
if (mKeyguardHostView != null) {
mKeyguardHostView.clearAppWidgetToShow();
+ mKeyguardHostView.setOnDismissAction(null);
}
if (mHideHintsRunnable != null) {
mMainQueue.removeCallbacks(mHideHintsRunnable);
@@ -324,6 +325,9 @@
mKeyguardWidgetPager.zoomOutToBouncer();
} else {
mKeyguardWidgetPager.zoomInFromBouncer();
+ if (mKeyguardHostView != null) {
+ mKeyguardHostView.setOnDismissAction(null);
+ }
}
}
}
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 4659c9d..7e4490e 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -10352,6 +10352,15 @@
return mSafeMode;
}
+ public void showAssistant() {
+ // TODO: What permission?
+ if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER)
+ != PackageManager.PERMISSION_GRANTED) {
+ return;
+ }
+ mPolicy.showAssistant();
+ }
+
void dumpPolicyLocked(PrintWriter pw, String[] args, boolean dumpAll) {
pw.println("WINDOW MANAGER POLICY STATE (dumpsys window policy)");
mPolicy.dump(" ", pw, args);
diff --git a/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java b/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
index fa2cb50..3e625f9 100644
--- a/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
+++ b/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
@@ -453,6 +453,11 @@
}
@Override
+ public void showAssistant() {
+
+ }
+
+ @Override
public IBinder getFocusedWindowToken() {
// TODO Auto-generated method stub
return null;