diff options
author | Jens Doll <jens.doll@gmail.com> | 2013-04-08 12:27:15 +0200 |
---|---|---|
committer | Jens Doll <jens.doll@gmail.com> | 2013-04-13 11:51:09 +0200 |
commit | 41cb63ab6e4f175832300f33717f0ae51b855d0b (patch) | |
tree | 4c9e81b9374930b0ab9b754d20d961df57a76429 /policy/src | |
parent | 43c1a406d67bb617d23a32549994908ddc9cc0ea (diff) | |
download | frameworks_base-41cb63ab6e4f175832300f33717f0ae51b855d0b.zip frameworks_base-41cb63ab6e4f175832300f33717f0ae51b855d0b.tar.gz frameworks_base-41cb63ab6e4f175832300f33717f0ae51b855d0b.tar.bz2 |
Adapt navigation bar's long press behaviour for pie controls
This commit brings the navigation bar long press behaviour to
pie controls.
Two things will be considered for long press:
* Long press on HOME will open Google Now.
* Long press on BACK will kill an application if enabled within
the debug options.
Patch Set #2:
* Jacob's colours
Patch Set #3:
* More blueish colours
* Using a longer time out for long press
(getLongPressTimeout() * 2)
* Moved killForegroundAppication() around
Patch Set #5:
* Shortened long press time out a bit
* Adjust time for info shade dynamically
Change-Id: I8cfa87a5be0678f0452011d85d427439d7cf31e9
Diffstat (limited to 'policy/src')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 42 |
1 files changed, 4 insertions, 38 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index e815781..a40f61f 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -77,6 +77,7 @@ import com.android.internal.policy.impl.keyguard.KeyguardViewManager; import com.android.internal.policy.impl.keyguard.KeyguardViewMediator; import com.android.internal.statusbar.IStatusBarService; import com.android.internal.telephony.ITelephony; +import com.android.internal.util.cm.DevUtils; import com.android.internal.widget.PointerLocationView; import android.util.DisplayMetrics; @@ -913,44 +914,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { Runnable mBackLongPress = new Runnable() { public void run() { - try { - final Intent intent = new Intent(Intent.ACTION_MAIN); - String defaultHomePackage = "com.android.launcher"; - intent.addCategory(Intent.CATEGORY_HOME); - final ResolveInfo res = mContext.getPackageManager().resolveActivity(intent, 0); - if (res.activityInfo != null && !res.activityInfo.packageName.equals("android")) { - defaultHomePackage = res.activityInfo.packageName; - } - boolean targetKilled = false; - IActivityManager am = ActivityManagerNative.getDefault(); - List<RunningAppProcessInfo> apps = am.getRunningAppProcesses(); - for (RunningAppProcessInfo appInfo : apps) { - int uid = appInfo.uid; - // Make sure it's a foreground user application (not system, - // root, phone, etc.) - if (uid >= Process.FIRST_APPLICATION_UID && uid <= Process.LAST_APPLICATION_UID - && appInfo.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND) { - if (appInfo.pkgList != null && (appInfo.pkgList.length > 0)) { - for (String pkg : appInfo.pkgList) { - if (!pkg.equals("com.android.systemui") && !pkg.equals(defaultHomePackage)) { - am.forceStopPackage(pkg, UserHandle.USER_CURRENT); - targetKilled = true; - break; - } - } - } else { - Process.killProcess(appInfo.pid); - targetKilled = true; - } - } - if (targetKilled) { - performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false); - Toast.makeText(mContext, R.string.app_killed_message, Toast.LENGTH_SHORT).show(); - break; - } - } - } catch (RemoteException remoteException) { - // Do nothing; just let it go. + if (DevUtils.killForegroundApplication(mContext)) { + performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false); + Toast.makeText(mContext, R.string.app_killed_message, Toast.LENGTH_SHORT).show(); } } }; |