--- /dev/null
+/*
+ * 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();
+}
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;
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;
@Override
public void onStart() {
publishBinderService(AUTOFILL_MANAGER_SERVICE, new AutoFillManagerServiceStub());
+ publishLocalService(AutofillManagerInternal.class, new LocalService());
}
@Override
}
}
+ 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) {
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;
WindowManagerInternal mWindowManagerInternal;
PowerManager mPowerManager;
ActivityManagerInternal mActivityManagerInternal;
+ AutofillManagerInternal mAutofillManagerInternal;
InputManagerInternal mInputManagerInternal;
InputMethodManagerInternal mInputMethodManagerInternal;
DreamManagerInternal mDreamManagerInternal;
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;
accessibilityShortcutActivated();
}
break;
+ case MSG_DISPATCH_BACK_KEY_TO_AUTOFILL:
+ mAutofillManagerInternal.onBackKeyPressed();
+ break;
}
}
}
}
}
+ if (mAutofillManagerInternal != null && event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_DISPATCH_BACK_KEY_TO_AUTOFILL));
+ }
+
return handled;
}
mSystemGestures.systemReady();
mImmersiveModeConfirmation.systemReady();
+
+ mAutofillManagerInternal = LocalServices.getService(AutofillManagerInternal.class);
}
/** {@inheritDoc} */