diff options
Diffstat (limited to 'packages')
13 files changed, 134 insertions, 36 deletions
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index d4ebb01..b94a258 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -176,6 +176,7 @@ android:theme="@style/RecentsStyle" android:excludeFromRecents="true" android:launchMode="singleInstance" + android:resumeWhilePausing="true" android:exported="true"> <intent-filter> <action android:name="com.android.systemui.TOGGLE_RECENTS" /> @@ -196,6 +197,8 @@ android:label="@string/accessibility_desc_recent_apps" android:launchMode="singleInstance" android:excludeFromRecents="true" + android:stateNotNeeded="true" + android:resumeWhilePausing="true" android:theme="@style/RecentsTheme"> <intent-filter> <action android:name="com.android.systemui.recents.TOGGLE_RECENTS" /> diff --git a/packages/SystemUI/res/drawable/stat_sys_vpn_ic.xml b/packages/SystemUI/res/drawable/stat_sys_vpn_ic.xml new file mode 100644 index 0000000..7ca8c40 --- /dev/null +++ b/packages/SystemUI/res/drawable/stat_sys_vpn_ic.xml @@ -0,0 +1,24 @@ +<!-- +Copyright (C) 2014 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="17.0dp" + android:height="17.0dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M12.700000,10.000000c-0.800000,-2.300000 -3.000000,-4.000000 -5.700000,-4.000000c-3.300000,0.000000 -6.000000,2.700000 -6.000000,6.000000s2.700000,6.000000 6.000000,6.000000c2.600000,0.000000 4.800000,-1.700000 5.700000,-4.000000L17.000000,14.000000l0.000000,4.000000l4.000000,0.000000l0.000000,-4.000000l2.000000,0.000000l0.000000,-4.000000L12.700000,10.000000zM7.000000,14.000000c-1.100000,0.000000 -2.000000,-0.900000 -2.000000,-2.000000c0.000000,-1.100000 0.900000,-2.000000 2.000000,-2.000000s2.000000,0.900000 2.000000,2.000000C9.000000,13.100000 8.100000,14.000000 7.000000,14.000000z"/> +</vector> diff --git a/packages/SystemUI/res/layout/signal_cluster_view.xml b/packages/SystemUI/res/layout/signal_cluster_view.xml index 347c8a9..3a8a17d 100644 --- a/packages/SystemUI/res/layout/signal_cluster_view.xml +++ b/packages/SystemUI/res/layout/signal_cluster_view.xml @@ -25,6 +25,13 @@ android:gravity="center_vertical" android:orientation="horizontal" > + <ImageView + android:id="@+id/vpn" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:paddingEnd="6dp" + android:src="@drawable/stat_sys_vpn_ic" + /> <FrameLayout android:id="@+id/wifi_combo" android:layout_height="wrap_content" diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 5399a39..0e18979 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -137,7 +137,7 @@ <!-- The min animation duration for animating the task in when transitioning from home. --> <integer name="recents_animate_task_enter_from_home_duration">275</integer> <!-- The animation stagger to apply to each task animation when transitioning from home. --> - <integer name="recents_animate_task_enter_from_home_delay">150</integer> + <integer name="recents_animate_task_enter_from_home_delay">10</integer> <!-- The short duration when animating in/out the lock to app button. --> <integer name="recents_animate_lock_to_app_button_short_duration">150</integer> <!-- The long duration when animating in/out the lock to app button. --> diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java index b7434fd..34430d9 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java @@ -203,8 +203,7 @@ public class RecentTasksLoader implements View.OnTouchListener { Drawable icon = getFullResIcon(td.resolveInfo, pm); if (td.userId != UserHandle.myUserId()) { // Need to badge the icon - icon = mContext.getPackageManager().getUserBadgedDrawableForDensity(icon, - new UserHandle(td.userId), null, 0); + icon = mContext.getPackageManager().getUserBadgedIcon(icon, new UserHandle(td.userId)); } if (DEBUG) Log.v(TAG, "Loaded bitmap for task " + td + ": " + thumbnail); diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java index 2d114c0..5fa9fa4 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java +++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java @@ -16,10 +16,12 @@ package com.android.systemui.recents; +import android.app.Activity; import android.app.ActivityManager; import android.app.ActivityOptions; import android.appwidget.AppWidgetProviderInfo; import android.content.ActivityNotFoundException; +import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -385,9 +387,9 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta toTask); if (toTransform != null && toTask.key != null) { Rect toTaskRect = toTransform.rect; - - // XXX: Reduce the memory usage the to the task bar height - Bitmap thumbnail = Bitmap.createBitmap(toTaskRect.width(), toTaskRect.height(), + int toHeaderWidth = (int) (mHeaderBar.getMeasuredWidth() * toTransform.scale); + int toHeaderHeight = (int) (mHeaderBar.getMeasuredHeight() * toTransform.scale); + Bitmap thumbnail = Bitmap.createBitmap(toHeaderWidth, toHeaderHeight, Bitmap.Config.ARGB_8888); if (Constants.DebugFlags.App.EnableTransitionThumbnailDebugMode) { thumbnail.eraseColor(0xFFff0000); @@ -401,7 +403,8 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta mStartAnimationTriggered = false; return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mStatusBarView, - thumbnail, toTaskRect.left, toTaskRect.top, this); + thumbnail, toTaskRect.left, toTaskRect.top, toTaskRect.width(), + toTaskRect.height(), this); } // If both the screenshot and thumbnail fails, then just fall back to the default transition @@ -562,11 +565,34 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta public void onAnimationStarted() { // Notify recents to start the enter animation if (!mStartAnimationTriggered) { + // There can be a race condition between the start animation callback and + // the start of the new activity (where we register the receiver that listens + // to this broadcast, so we add our own receiver and if that gets called, then + // we know the activity has not yet started and we can retry sending the broadcast. + BroadcastReceiver fallbackReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (getResultCode() == Activity.RESULT_OK) { + mStartAnimationTriggered = true; + return; + } + + // Schedule for the broadcast to be sent again after some time + mHandler.postDelayed(new Runnable() { + @Override + public void run() { + onAnimationStarted(); + } + }, 75); + } + }; + + // Send the broadcast to notify Recents that the animation has started Intent intent = new Intent(ACTION_START_ENTER_ANIMATION); intent.setPackage(mContext.getPackageName()); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); - mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT); - mStartAnimationTriggered = true; + mContext.sendOrderedBroadcastAsUser(intent, UserHandle.CURRENT, null, + fallbackReceiver, null, Activity.RESULT_CANCELED, null, null); } } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index ec7799a..8f92027 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java @@ -146,6 +146,9 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView ReferenceCountedTrigger t = new ReferenceCountedTrigger(context, null, null, null); mRecentsView.startEnterRecentsAnimation(new ViewAnimation.TaskViewEnterContext(t)); onEnterAnimationTriggered(); + // Notify the fallback receiver that we have successfully got the broadcast + // See AlternateRecentsComponent.onAnimationStarted() + setResultCode(Activity.RESULT_OK); } } }; diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java index 07a42bd..887cbac 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java +++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java @@ -356,7 +356,7 @@ public class SystemServicesProxy { */ public Drawable getBadgedIcon(Drawable icon, int userId) { if (userId != UserHandle.myUserId()) { - icon = mPm.getUserBadgedDrawableForDensity(icon, new UserHandle(userId), null, 0); + icon = mPm.getUserBadgedIcon(icon, new UserHandle(userId)); } return icon; } diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java index 0c6e7b6..1bfb41f 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java @@ -413,10 +413,8 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV final SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); ActivityOptions opts = null; - int thumbnailWidth = transform.rect.width(); - int thumbnailHeight = transform.rect.height(); - if (task.thumbnail != null && thumbnailWidth > 0 && thumbnailHeight > 0 && - task.thumbnail.getWidth() > 0 && task.thumbnail.getHeight() > 0) { + if (task.thumbnail != null && task.thumbnail.getWidth() > 0 && + task.thumbnail.getHeight() > 0) { Bitmap b; if (tv != null) { // Disable any focused state before we draw the header @@ -424,7 +422,11 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV tv.unsetFocusedTask(); } - b = Bitmap.createBitmap(thumbnailWidth, thumbnailHeight, Bitmap.Config.ARGB_8888); + float scale = tv.getScaleX(); + int fromHeaderWidth = (int) (tv.mHeaderView.getMeasuredWidth() * scale); + int fromHeaderHeight = (int) (tv.mHeaderView.getMeasuredHeight() * scale); + b = Bitmap.createBitmap(fromHeaderWidth, fromHeaderHeight, + Bitmap.Config.ARGB_8888); if (Constants.DebugFlags.App.EnableTransitionThumbnailDebugMode) { b.eraseColor(0xFFff0000); } else { @@ -435,7 +437,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV } } else { // Notify the system to skip the thumbnail layer by using an ALPHA_8 bitmap - b = Bitmap.createBitmap(thumbnailWidth, thumbnailHeight, Bitmap.Config.ALPHA_8); + b = Bitmap.createBitmap(1, 1, Bitmap.Config.ALPHA_8); } ActivityOptions.OnAnimationStartedListener animStartedListener = null; if (lockToTask) { @@ -456,7 +458,8 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV }; } opts = ActivityOptions.makeThumbnailAspectScaleUpAnimation(sourceView, - b, offsetX, offsetY, animStartedListener); + b, offsetX, offsetY, transform.rect.width(), transform.rect.height(), + animStartedListener); } final ActivityOptions launchOpts = opts; diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java index eecc170..49aa52b 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java @@ -839,25 +839,28 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, @Override public void onClick(final View v) { - // We purposely post the handler delayed to allow for the touch feedback to draw final TaskView tv = this; - postDelayed(new Runnable() { - @Override - public void run() { - if (Constants.DebugFlags.App.EnableTaskFiltering && v == mHeaderView.mApplicationIcon) { - mCb.onTaskViewAppIconClicked(tv); - } else if (v == mHeaderView.mDismissButton) { - dismissTask(); - } else { - if (v == mActionButtonView) { - // Reset the translation of the action button before we animate it out - mActionButtonView.setTranslationZ(0f); + final boolean delayViewClick = (v != this); + if (delayViewClick) { + // We purposely post the handler delayed to allow for the touch feedback to draw + postDelayed(new Runnable() { + @Override + public void run() { + if (Constants.DebugFlags.App.EnableTaskFiltering && v == mHeaderView.mApplicationIcon) { + mCb.onTaskViewAppIconClicked(tv); + } else if (v == mHeaderView.mDismissButton) { + dismissTask(); } - mCb.onTaskViewClicked(tv, tv.getTask(), - (v == mFooterView || v == mActionButtonView)); } + }, 125); + } else { + if (v == mActionButtonView) { + // Reset the translation of the action button before we animate it out + mActionButtonView.setTranslationZ(0f); } - }, 125); + mCb.onTaskViewClicked(tv, tv.getTask(), + (v == mFooterView || v == mActionButtonView)); + } } /**** View.OnLongClickListener Implementation ****/ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java index 5883c26..740211f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java @@ -27,17 +27,21 @@ import android.widget.LinearLayout; import com.android.systemui.R; import com.android.systemui.statusbar.policy.NetworkControllerImpl; +import com.android.systemui.statusbar.policy.SecurityController; // Intimately tied to the design of res/layout/signal_cluster_view.xml public class SignalClusterView extends LinearLayout - implements NetworkControllerImpl.SignalCluster { + implements NetworkControllerImpl.SignalCluster, + SecurityController.SecurityControllerCallback { static final String TAG = "SignalClusterView"; static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); NetworkControllerImpl mNC; + SecurityController mSC; + private boolean mVpnVisible = false; private boolean mWifiVisible = false; private int mWifiStrengthId = 0; private boolean mMobileVisible = false; @@ -48,7 +52,7 @@ public class SignalClusterView private boolean mRoaming; ViewGroup mWifiGroup, mMobileGroup; - ImageView mWifi, mMobile, mMobileType, mAirplane; + ImageView mVpn, mWifi, mMobile, mMobileType, mAirplane; View mWifiAirplaneSpacer; public SignalClusterView(Context context) { @@ -68,10 +72,18 @@ public class SignalClusterView mNC = nc; } + public void setSecurityController(SecurityController sc) { + if (DEBUG) Log.d(TAG, "SecurityController=" + sc); + mSC = sc; + mSC.addCallback(this); + mVpnVisible = mSC.isVpnEnabled(); + } + @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); + mVpn = (ImageView) findViewById(R.id.vpn); mWifiGroup = (ViewGroup) findViewById(R.id.wifi_combo); mWifi = (ImageView) findViewById(R.id.wifi_signal); mMobileGroup = (ViewGroup) findViewById(R.id.mobile_combo); @@ -85,6 +97,7 @@ public class SignalClusterView @Override protected void onDetachedFromWindow() { + mVpn = null; mWifiGroup = null; mWifi = null; mMobileGroup = null; @@ -95,6 +108,18 @@ public class SignalClusterView super.onDetachedFromWindow(); } + // From SecurityController. + @Override + public void onStateChanged() { + post(new Runnable() { + @Override + public void run() { + mVpnVisible = mSC.isVpnEnabled(); + apply(); + } + }); + } + @Override public void setWifiIndicators(boolean visible, int strengthIcon, String contentDescription) { mWifiVisible = visible; @@ -168,6 +193,8 @@ public class SignalClusterView private void apply() { if (mWifiGroup == null) return; + mVpn.setVisibility(mVpnVisible ? View.VISIBLE : View.GONE); + if (DEBUG) Log.d(TAG, String.format("vpn: %s", mVpnVisible ? "VISIBLE" : "GONE")); if (mWifiVisible) { mWifi.setImageResource(mWifiStrengthId); mWifiGroup.setContentDescription(mWifiDescription); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 861bf4a..8497d8a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -786,8 +786,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mNetworkController.addSignalCluster(signalCluster); mNetworkController.addSignalCluster(signalClusterKeyguard); mNetworkController.addSignalCluster(signalClusterQs); + signalCluster.setSecurityController(mSecurityController); signalCluster.setNetworkController(mNetworkController); + signalClusterKeyguard.setSecurityController(mSecurityController); signalClusterKeyguard.setNetworkController(mNetworkController); + signalClusterQs.setSecurityController(mSecurityController); signalClusterQs.setNetworkController(mNetworkController); final boolean isAPhone = mNetworkController.hasVoiceCallingFeature(); if (isAPhone) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java index a15ddaf..2fbb812 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java @@ -139,14 +139,14 @@ public class SecurityControllerImpl implements SecurityController { } @Override - public void addCallback(SecurityControllerCallback callback) { + public void removeCallback(SecurityControllerCallback callback) { if (callback == null) return; if (DEBUG) Log.d(TAG, "removeCallback " + callback); mCallbacks.remove(callback); } @Override - public void removeCallback(SecurityControllerCallback callback) { + public void addCallback(SecurityControllerCallback callback) { if (callback == null || mCallbacks.contains(callback)) return; if (DEBUG) Log.d(TAG, "addCallback " + callback); mCallbacks.add(callback); |