Merge "Closes Autofill UIs when back button is pressed." into oc-dev

am: 8db148093c

Change-Id: I8f0bfb221b17804d3f9ec7b682ebd1256f53aa76
This commit is contained in:
Felipe Leme
2017-06-09 21:05:39 +00:00
committed by android-build-merger
3 changed files with 53 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2017 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 android.view.autofill;
/**
* Autofill Manager local system service interface.
*
* @hide Only for use within the system server.
*/
public abstract class AutofillManagerInternal {
/**
* Notifies the manager that the back key was pressed.
*/
public abstract void onBackKeyPressed();
}

View File

@@ -19,10 +19,10 @@ package com.android.server.autofill;
import static android.Manifest.permission.MANAGE_AUTO_FILL;
import static android.content.Context.AUTOFILL_MANAGER_SERVICE;
import static com.android.server.autofill.Helper.bundleToString;
import static com.android.server.autofill.Helper.sDebug;
import static com.android.server.autofill.Helper.sPartitionMaxCount;
import static com.android.server.autofill.Helper.sVerbose;
import static com.android.server.autofill.Helper.bundleToString;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -58,6 +58,7 @@ import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.view.autofill.AutofillId;
import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillManagerInternal;
import android.view.autofill.AutofillValue;
import android.view.autofill.IAutoFillManager;
import android.view.autofill.IAutoFillManagerClient;
@@ -251,6 +252,7 @@ public final class AutofillManagerService extends SystemService {
@Override
public void onStart() {
publishBinderService(AUTOFILL_MANAGER_SERVICE, new AutoFillManagerServiceStub());
publishLocalService(AutofillManagerInternal.class, new LocalService());
}
@Override
@@ -463,6 +465,15 @@ public final class AutofillManagerService extends SystemService {
}
}
private final class LocalService extends AutofillManagerInternal {
@Override
public void onBackKeyPressed() {
if (sDebug) Slog.d(TAG, "onBackKeyPressed()");
mUi.hideAll(null);
}
}
final class AutoFillManagerServiceStub extends IAutoFillManager.Stub {
@Override
public int addClient(IAutoFillManagerClient client, int userId) {

View File

@@ -221,6 +221,7 @@ import android.view.accessibility.AccessibilityManager;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.AnimationUtils;
import android.view.autofill.AutofillManagerInternal;
import android.view.inputmethod.InputMethodManagerInternal;
import com.android.internal.R;
@@ -407,6 +408,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
WindowManagerInternal mWindowManagerInternal;
PowerManager mPowerManager;
ActivityManagerInternal mActivityManagerInternal;
AutofillManagerInternal mAutofillManagerInternal;
InputManagerInternal mInputManagerInternal;
InputMethodManagerInternal mInputMethodManagerInternal;
DreamManagerInternal mDreamManagerInternal;
@@ -831,6 +833,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
private static final int MSG_ACCESSIBILITY_SHORTCUT = 21;
private static final int MSG_BUGREPORT_TV = 22;
private static final int MSG_ACCESSIBILITY_TV = 23;
private static final int MSG_DISPATCH_BACK_KEY_TO_AUTOFILL = 24;
private static final int MSG_REQUEST_TRANSIENT_BARS_ARG_STATUS = 0;
private static final int MSG_REQUEST_TRANSIENT_BARS_ARG_NAVIGATION = 1;
@@ -917,6 +920,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
accessibilityShortcutActivated();
}
break;
case MSG_DISPATCH_BACK_KEY_TO_AUTOFILL:
mAutofillManagerInternal.onBackKeyPressed();
break;
}
}
}
@@ -1224,6 +1230,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
if (mAutofillManagerInternal != null && event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
mHandler.sendMessage(mHandler.obtainMessage(MSG_DISPATCH_BACK_KEY_TO_AUTOFILL));
}
return handled;
}
@@ -7239,6 +7249,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mSystemGestures.systemReady();
mImmersiveModeConfirmation.systemReady();
mAutofillManagerInternal = LocalServices.getService(AutofillManagerInternal.class);
}
/** {@inheritDoc} */