summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2012-11-08 00:51:25 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-11-08 00:51:26 -0800
commit6be441c532688762b735ae2a1276195b40bf33b4 (patch)
tree553d2ef9eeb84f98b14013f28c6c38d261561966
parent5dd8b00891faff39ecadb1a0322e14528883bfe3 (diff)
parent4eeb4f664ac6b5901a8e874dcf70c0382295f792 (diff)
downloadbase-6be441c532688762b735ae2a1276195b40bf33b4.tar.gz
Merge "Add mechanism to kick keyguard to show the assistant" into jb-mr1-lockscreen-dev
-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 fdaf39ed6a9c..0fe2a8e3f830 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 4ccb5020a3d6..26739b3d5026 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 000000000000..f3333b7cd816
--- /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 000000000000..b4ed2789930e
--- /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 10a8b1b62229..68a028975681 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 4b0e8184abcf..76613e020d88 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 54bf20dafb80..d9c07f8a7220 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 8c9e30af7da4..368cfcebc9db 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 af3434761066..c81ff55377d6 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 128930ad076c..23c642dc882d 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 88cf343e8019..945e9c2ff065 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 4659c9d9f71c..7e4490e63ecf 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 fa2cb506b3e5..3e625f98367d 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;