summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2012-11-08 13:13:23 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2012-11-08 13:13:23 -0800
commita2bf6181dfca0f93461fc041f2bd2444551a4515 (patch)
tree6ff5aa54451c772965985395ec17b0a400270802
parent79b08a499f5ac7aa4f9dcba4e6c5d9a54463799b (diff)
parent2c29deaa2650091d9206b8fa93f8a447ee247d52 (diff)
downloadframeworks_base-a2bf6181dfca0f93461fc041f2bd2444551a4515.zip
frameworks_base-a2bf6181dfca0f93461fc041f2bd2444551a4515.tar.gz
frameworks_base-a2bf6181dfca0f93461fc041f2bd2444551a4515.tar.bz2
am 2c29deaa: am 6be441c5: Merge "Add mechanism to kick keyguard to show the assistant" into jb-mr1-lockscreen-dev
* commit '2c29deaa2650091d9206b8fa93f8a447ee247d52': Add mechanism to kick keyguard to show the assistant
-rw-r--r--core/java/android/view/IWindowManager.aidl66
-rw-r--r--core/java/android/view/WindowManagerPolicy.java6
-rw-r--r--core/res/res/anim/keyguard_action_assist_enter.xml32
-rw-r--r--core/res/res/anim/keyguard_action_assist_exit.xml23
-rw-r--r--core/res/res/values/symbols.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/SearchPanelView.java25
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java5
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java30
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java6
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java13
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java4
-rwxr-xr-xservices/java/com/android/server/wm/WindowManagerService.java9
-rw-r--r--tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java5
13 files changed, 179 insertions, 48 deletions
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 @@ interface IWindowManager
Configuration updateOrientationFromAppTokens(in Configuration currentConfig,
IBinder freezeThisOneIfNeeded);
void setNewConfiguration(in Configuration config);
-
+
void startFreezingScreen(int exitAnim, int enterAnim);
void stopFreezingScreen();
@@ -121,13 +121,13 @@ interface IWindowManager
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 @@ interface IWindowManager
* {@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 @@ interface IWindowManager
*/
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);
-
- /**
- * 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);
+ /**
+ * 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();
+
+ /**
+ * 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 @@ interface IWindowManager
* 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 @@ public interface WindowManagerPolicy {
* @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/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.Context;
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 @@ public class SearchPanelView extends FrameLayout implements
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 class SearchPanelView extends FrameLayout implements
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 @@ public class SearchPanelView extends FrameLayout implements
// 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 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
@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 8c9e30a..368cfce 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.Activity;
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.Looper;
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;
@@ -1442,4 +1445,31 @@ public class KeyguardHostView extends KeyguardViewBase {
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 af34347..c81ff55 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
@@ -425,4 +425,10 @@ public class KeyguardViewManager {
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 @@ public class KeyguardViewMediator {
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 @@ public class KeyguardViewMediator {
doKeyguardLocked((Bundle) msg.obj);
}
break;
+ case SHOW_ASSISTANT:
+ handleShowAssistant();
+ break;
}
}
};
@@ -1393,4 +1397,13 @@ public class KeyguardViewMediator {
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 88cf343..945e9c2 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 @@ public class KeyguardViewStateManager implements
// once the user swipes a page we clear that behavior
if (mKeyguardHostView != null) {
mKeyguardHostView.clearAppWidgetToShow();
+ mKeyguardHostView.setOnDismissAction(null);
}
if (mHideHintsRunnable != null) {
mMainQueue.removeCallbacks(mHideHintsRunnable);
@@ -316,6 +317,9 @@ public class KeyguardViewStateManager implements
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 @@ public class WindowManagerService extends IWindowManager.Stub
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 @@ public class IWindowManagerImpl implements IWindowManager {
}
@Override
+ public void showAssistant() {
+
+ }
+
+ @Override
public IBinder getFocusedWindowToken() {
// TODO Auto-generated method stub
return null;