Merge "Fix a couple PIP related issues."

This commit is contained in:
TreeHugger Robot
2018-01-16 22:55:17 +00:00
committed by Android (Google) Code Review
5 changed files with 74 additions and 34 deletions

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2018 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.
*/
package com.android.internal.policy;
import android.os.RemoteException;
import com.android.internal.policy.IKeyguardDismissCallback;
/**
* @hide
*/
public class KeyguardDismissCallback extends IKeyguardDismissCallback.Stub {
@Override
public void onDismissError() throws RemoteException {
// To be overidden
}
@Override
public void onDismissSucceeded() throws RemoteException {
// To be overidden
}
@Override
public void onDismissCancelled() throws RemoteException {
// To be overidden
}
}

View File

@@ -373,7 +373,7 @@ public class PipMenuActivity extends Activity {
if (menuState == MENU_STATE_FULL) {
mMenuContainerAnimator.playTogether(menuAnim, settingsAnim, dismissAnim);
} else {
mMenuContainerAnimator.playTogether(settingsAnim, dismissAnim);
mMenuContainerAnimator.playTogether(dismissAnim);
}
mMenuContainerAnimator.setInterpolator(Interpolators.ALPHA_IN);
mMenuContainerAnimator.setDuration(MENU_FADE_DURATION);

View File

@@ -397,6 +397,7 @@ import com.android.internal.os.ProcessCpuTracker;
import com.android.internal.os.TransferPipe;
import com.android.internal.os.Zygote;
import com.android.internal.policy.IKeyguardDismissCallback;
import com.android.internal.policy.KeyguardDismissCallback;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.DumpUtils;
@@ -8393,21 +8394,11 @@ public class ActivityManagerService extends IActivityManager.Stub
// entering picture-in-picture (this will prompt the user to authenticate if the
// device is currently locked).
try {
dismissKeyguard(token, new IKeyguardDismissCallback.Stub() {
@Override
public void onDismissError() throws RemoteException {
// Do nothing
}
dismissKeyguard(token, new KeyguardDismissCallback() {
@Override
public void onDismissSucceeded() throws RemoteException {
mHandler.post(enterPipRunnable);
}
@Override
public void onDismissCancelled() throws RemoteException {
// Do nothing
}
}, null /* message */);
} catch (RemoteException e) {
// Local call

View File

@@ -269,6 +269,7 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.policy.IKeyguardDismissCallback;
import com.android.internal.policy.IShortcutService;
import com.android.internal.policy.KeyguardDismissCallback;
import com.android.internal.policy.PhoneWindow;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.util.ArrayUtils;
@@ -4211,20 +4212,23 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (isKeyguardShowingAndNotOccluded()) {
// don't launch home if keyguard showing
return;
}
if (!mKeyguardOccluded && mKeyguardDelegate.isInputRestricted()) {
} else if (mKeyguardOccluded && mKeyguardDelegate.isShowing()) {
mKeyguardDelegate.dismiss(new KeyguardDismissCallback() {
@Override
public void onDismissSucceeded() throws RemoteException {
mHandler.post(() -> {
startDockOrHome(true /*fromHomeKey*/, awakenFromDreams);
});
}
}, null /* message */);
return;
} else if (!mKeyguardOccluded && mKeyguardDelegate.isInputRestricted()) {
// when in keyguard restricted mode, must first verify unlock
// before launching home
mKeyguardDelegate.verifyUnlock(new OnKeyguardExitResult() {
@Override
public void onKeyguardExitResult(boolean success) {
if (success) {
try {
ActivityManager.getService().stopAppSwitches();
} catch (RemoteException e) {
}
sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
startDockOrHome(true /*fromHomeKey*/, awakenFromDreams);
}
}
@@ -4234,11 +4238,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
// no keyguard stuff to worry about, just launch home!
try {
ActivityManager.getService().stopAppSwitches();
} catch (RemoteException e) {
}
if (mRecentsVisible) {
try {
ActivityManager.getService().stopAppSwitches();
} catch (RemoteException e) {}
// Hide Recents and notify it to launch Home
if (awakenFromDreams) {
awakenDreams();
@@ -4246,7 +4250,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
hideRecentApps(false, true);
} else {
// Otherwise, just launch Home
sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
startDockOrHome(true /*fromHomeKey*/, awakenFromDreams);
}
}
@@ -7633,6 +7636,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
void startDockOrHome(boolean fromHomeKey, boolean awakenFromDreams) {
try {
ActivityManager.getService().stopAppSwitches();
} catch (RemoteException e) {}
sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
if (awakenFromDreams) {
awakenDreams();
}
@@ -7672,11 +7680,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
if (false) {
// This code always brings home to the front.
try {
ActivityManager.getService().stopAppSwitches();
} catch (RemoteException e) {
}
sendCloseSystemWindows();
startDockOrHome(false /*fromHomeKey*/, true /* awakenFromDreams */);
} else {
// This code brings home to the front or, if it is already

View File

@@ -360,14 +360,19 @@ class PinnedStackController {
* Sets the Ime state and height.
*/
void setAdjustedForIme(boolean adjustedForIme, int imeHeight) {
// Return early if there is no state change
if (mIsImeShowing == adjustedForIme && mImeHeight == imeHeight) {
// Due to the order of callbacks from the system, we may receive an ime height even when
// {@param adjustedForIme} is false, and also a zero height when {@param adjustedForIme}
// is true. Instead, ensure that the ime state changes with the height and if the ime is
// showing, then the height is non-zero.
final boolean imeShowing = adjustedForIme && imeHeight > 0;
imeHeight = imeShowing ? imeHeight : 0;
if (imeShowing == mIsImeShowing && imeHeight == mImeHeight) {
return;
}
mIsImeShowing = adjustedForIme;
mIsImeShowing = imeShowing;
mImeHeight = imeHeight;
notifyImeVisibilityChanged(adjustedForIme, imeHeight);
notifyImeVisibilityChanged(imeShowing, imeHeight);
notifyMovementBoundsChanged(true /* fromImeAdjustment */);
}