Loading packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java +3 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,9 @@ public class KeyguardHostView extends KeyguardViewBase { } public interface OnDismissAction { /* returns true if the dismiss should be deferred */ /** * @return true if the dismiss should be deferred */ boolean onDismiss(); } Loading packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +88 −56 Original line number Diff line number Diff line Loading @@ -81,6 +81,8 @@ import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; import java.util.ArrayList; import java.util.Locale; import static com.android.keyguard.KeyguardHostView.OnDismissAction; public abstract class BaseStatusBar extends SystemUI implements CommandQueue.Callbacks, ActivatableNotificationView.OnActivatedListener { public static final String TAG = "StatusBar"; Loading Loading @@ -208,12 +210,16 @@ public abstract class BaseStatusBar extends SystemUI implements private RemoteViews.OnClickHandler mOnClickHandler = new RemoteViews.OnClickHandler() { @Override public boolean onClickHandler(View view, PendingIntent pendingIntent, Intent fillInIntent) { public boolean onClickHandler( final View view, final PendingIntent pendingIntent, final Intent fillInIntent) { if (DEBUG) { Log.v(TAG, "Notification click handler invoked for intent: " + pendingIntent); } final boolean isActivity = pendingIntent.isActivity(); if (isActivity) { startNotificationActivity(new OnDismissAction() { @Override public boolean onDismiss() { try { // The intent we are sending is for the application, which // won't have permission to immediately start an activity after Loading @@ -225,16 +231,26 @@ public abstract class BaseStatusBar extends SystemUI implements ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity(); } catch (RemoteException e) { } } boolean handled = super.onClickHandler(view, pendingIntent, fillInIntent); boolean handled = superOnClickHandler(view, pendingIntent, fillInIntent); if (isActivity && handled) { // close the shade if it was open if (handled) { animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE); visibilityChanged(false); } return handled; return handled; // Wait for activity start. } }); return true; } else { return super.onClickHandler(view, pendingIntent, fillInIntent); } } private boolean superOnClickHandler(View view, PendingIntent pendingIntent, Intent fillInIntent) { return super.onClickHandler(view, pendingIntent, fillInIntent); } }; Loading Loading @@ -381,6 +397,14 @@ public abstract class BaseStatusBar extends SystemUI implements } } /** * Takes the necessary steps to prepare the status bar for starting an activity, then starts it. * @param action A dismiss action that is called if it's safe to start the activity. */ protected void startNotificationActivity(OnDismissAction action) { action.onDismiss(); } @Override protected void onConfigurationChanged(Configuration newConfig) { final Locale locale = mContext.getResources().getConfiguration().locale; Loading Loading @@ -946,7 +970,9 @@ public abstract class BaseStatusBar extends SystemUI implements mIsHeadsUp = forHun; } public void onClick(View v) { public void onClick(final View v) { startNotificationActivity(new OnDismissAction() { public boolean onDismiss() { try { // The intent we are sending is for the application, which // won't have permission to immediately start an activity after Loading @@ -959,20 +985,21 @@ public abstract class BaseStatusBar extends SystemUI implements } catch (RemoteException e) { } boolean sent = false; if (mIntent != null) { int[] pos = new int[2]; v.getLocationOnScreen(pos); Intent overlay = new Intent(); overlay.setSourceBounds( new Rect(pos[0], pos[1], pos[0]+v.getWidth(), pos[1]+v.getHeight())); overlay.setSourceBounds(new Rect(pos[0], pos[1], pos[0]+v.getWidth(), pos[1]+v.getHeight())); try { mIntent.send(mContext, 0, overlay); sent = true; } catch (PendingIntent.CanceledException e) { // the stack trace isn't very helpful here. Just log the exception message. // the stack trace isn't very helpful here. // Just log the exception message. Log.w(TAG, "Sending contentIntent failed: " + e); } KeyguardTouchDelegate.getInstance(mContext).dismiss(); } try { Loading @@ -987,6 +1014,11 @@ public abstract class BaseStatusBar extends SystemUI implements // close the shade if it was open animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE); visibilityChanged(false); boolean waitForActivityLaunch = sent && mIntent.isActivity(); return waitForActivityLaunch; } }); } } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +7 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import com.android.keyguard.R; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.keyguard.KeyguardViewMediator; import static com.android.keyguard.KeyguardHostView.OnDismissAction; import static com.android.keyguard.KeyguardSecurityModel.*; /** Loading Loading @@ -69,6 +70,12 @@ public class KeyguardBouncer { } } public void showWithDismissAction(OnDismissAction r) { ensureView(); mKeyguardView.setOnDismissAction(r); show(); } public void hide() { if (mKeyguardView != null) { mKeyguardView.cleanUp(); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +10 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SHOWN; import static android.app.StatusBarManager.WINDOW_STATE_HIDDEN; import static android.app.StatusBarManager.WINDOW_STATE_SHOWING; import static android.app.StatusBarManager.windowStateToString; import static com.android.keyguard.KeyguardHostView.OnDismissAction; import static com.android.systemui.statusbar.phone.BarTransitions.MODE_LIGHTS_OUT; import static com.android.systemui.statusbar.phone.BarTransitions.MODE_OPAQUE; import static com.android.systemui.statusbar.phone.BarTransitions.MODE_SEMI_TRANSPARENT; Loading Loading @@ -2344,6 +2345,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } }; @Override protected void startNotificationActivity(OnDismissAction action) { if (mStatusBarKeyguardViewManager.isShowing()) { mStatusBarKeyguardViewManager.dismissWithAction(action); } else { action.onDismiss(); } } // SystemUIService notifies SystemBars of configuration changes, which then calls down here @Override protected void onConfigurationChanged(Configuration newConfig) { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +9 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.ViewMediatorCallback; import static com.android.keyguard.KeyguardHostView.OnDismissAction; /** * Manages creating, showing, hiding and resetting the keyguard within the status bar. Calls back * via {@link ViewMediatorCallback} to poke the wake lock and report that the keyguard is done, Loading Loading @@ -108,6 +110,13 @@ public class StatusBarKeyguardViewManager { updateStates(); } public void dismissWithAction(OnDismissAction r) { if (!mOccluded) { mBouncer.showWithDismissAction(r); } updateStates(); } /** * Reset the state of the view. */ Loading Loading
packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java +3 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,9 @@ public class KeyguardHostView extends KeyguardViewBase { } public interface OnDismissAction { /* returns true if the dismiss should be deferred */ /** * @return true if the dismiss should be deferred */ boolean onDismiss(); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +88 −56 Original line number Diff line number Diff line Loading @@ -81,6 +81,8 @@ import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; import java.util.ArrayList; import java.util.Locale; import static com.android.keyguard.KeyguardHostView.OnDismissAction; public abstract class BaseStatusBar extends SystemUI implements CommandQueue.Callbacks, ActivatableNotificationView.OnActivatedListener { public static final String TAG = "StatusBar"; Loading Loading @@ -208,12 +210,16 @@ public abstract class BaseStatusBar extends SystemUI implements private RemoteViews.OnClickHandler mOnClickHandler = new RemoteViews.OnClickHandler() { @Override public boolean onClickHandler(View view, PendingIntent pendingIntent, Intent fillInIntent) { public boolean onClickHandler( final View view, final PendingIntent pendingIntent, final Intent fillInIntent) { if (DEBUG) { Log.v(TAG, "Notification click handler invoked for intent: " + pendingIntent); } final boolean isActivity = pendingIntent.isActivity(); if (isActivity) { startNotificationActivity(new OnDismissAction() { @Override public boolean onDismiss() { try { // The intent we are sending is for the application, which // won't have permission to immediately start an activity after Loading @@ -225,16 +231,26 @@ public abstract class BaseStatusBar extends SystemUI implements ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity(); } catch (RemoteException e) { } } boolean handled = super.onClickHandler(view, pendingIntent, fillInIntent); boolean handled = superOnClickHandler(view, pendingIntent, fillInIntent); if (isActivity && handled) { // close the shade if it was open if (handled) { animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE); visibilityChanged(false); } return handled; return handled; // Wait for activity start. } }); return true; } else { return super.onClickHandler(view, pendingIntent, fillInIntent); } } private boolean superOnClickHandler(View view, PendingIntent pendingIntent, Intent fillInIntent) { return super.onClickHandler(view, pendingIntent, fillInIntent); } }; Loading Loading @@ -381,6 +397,14 @@ public abstract class BaseStatusBar extends SystemUI implements } } /** * Takes the necessary steps to prepare the status bar for starting an activity, then starts it. * @param action A dismiss action that is called if it's safe to start the activity. */ protected void startNotificationActivity(OnDismissAction action) { action.onDismiss(); } @Override protected void onConfigurationChanged(Configuration newConfig) { final Locale locale = mContext.getResources().getConfiguration().locale; Loading Loading @@ -946,7 +970,9 @@ public abstract class BaseStatusBar extends SystemUI implements mIsHeadsUp = forHun; } public void onClick(View v) { public void onClick(final View v) { startNotificationActivity(new OnDismissAction() { public boolean onDismiss() { try { // The intent we are sending is for the application, which // won't have permission to immediately start an activity after Loading @@ -959,20 +985,21 @@ public abstract class BaseStatusBar extends SystemUI implements } catch (RemoteException e) { } boolean sent = false; if (mIntent != null) { int[] pos = new int[2]; v.getLocationOnScreen(pos); Intent overlay = new Intent(); overlay.setSourceBounds( new Rect(pos[0], pos[1], pos[0]+v.getWidth(), pos[1]+v.getHeight())); overlay.setSourceBounds(new Rect(pos[0], pos[1], pos[0]+v.getWidth(), pos[1]+v.getHeight())); try { mIntent.send(mContext, 0, overlay); sent = true; } catch (PendingIntent.CanceledException e) { // the stack trace isn't very helpful here. Just log the exception message. // the stack trace isn't very helpful here. // Just log the exception message. Log.w(TAG, "Sending contentIntent failed: " + e); } KeyguardTouchDelegate.getInstance(mContext).dismiss(); } try { Loading @@ -987,6 +1014,11 @@ public abstract class BaseStatusBar extends SystemUI implements // close the shade if it was open animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE); visibilityChanged(false); boolean waitForActivityLaunch = sent && mIntent.isActivity(); return waitForActivityLaunch; } }); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +7 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import com.android.keyguard.R; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.keyguard.KeyguardViewMediator; import static com.android.keyguard.KeyguardHostView.OnDismissAction; import static com.android.keyguard.KeyguardSecurityModel.*; /** Loading Loading @@ -69,6 +70,12 @@ public class KeyguardBouncer { } } public void showWithDismissAction(OnDismissAction r) { ensureView(); mKeyguardView.setOnDismissAction(r); show(); } public void hide() { if (mKeyguardView != null) { mKeyguardView.cleanUp(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +10 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SHOWN; import static android.app.StatusBarManager.WINDOW_STATE_HIDDEN; import static android.app.StatusBarManager.WINDOW_STATE_SHOWING; import static android.app.StatusBarManager.windowStateToString; import static com.android.keyguard.KeyguardHostView.OnDismissAction; import static com.android.systemui.statusbar.phone.BarTransitions.MODE_LIGHTS_OUT; import static com.android.systemui.statusbar.phone.BarTransitions.MODE_OPAQUE; import static com.android.systemui.statusbar.phone.BarTransitions.MODE_SEMI_TRANSPARENT; Loading Loading @@ -2344,6 +2345,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } }; @Override protected void startNotificationActivity(OnDismissAction action) { if (mStatusBarKeyguardViewManager.isShowing()) { mStatusBarKeyguardViewManager.dismissWithAction(action); } else { action.onDismiss(); } } // SystemUIService notifies SystemBars of configuration changes, which then calls down here @Override protected void onConfigurationChanged(Configuration newConfig) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +9 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.ViewMediatorCallback; import static com.android.keyguard.KeyguardHostView.OnDismissAction; /** * Manages creating, showing, hiding and resetting the keyguard within the status bar. Calls back * via {@link ViewMediatorCallback} to poke the wake lock and report that the keyguard is done, Loading Loading @@ -108,6 +110,13 @@ public class StatusBarKeyguardViewManager { updateStates(); } public void dismissWithAction(OnDismissAction r) { if (!mOccluded) { mBouncer.showWithDismissAction(r); } updateStates(); } /** * Reset the state of the view. */ Loading