Merge "Added java wrapper for update engine stable" into main
diff --git a/Android.bp b/Android.bp
index 52b4abe..ebdb1a1 100644
--- a/Android.bp
+++ b/Android.bp
@@ -208,6 +208,7 @@
"updatable-driver-protos",
"ota_metadata_proto_java",
"android.hidl.base-V1.0-java",
+ "android.hidl.manager-V1.2-java",
"android.hardware.cas-V1-java", // AIDL
"android.hardware.cas-V1.0-java",
"android.hardware.cas-V1.1-java",
diff --git a/core/java/android/content/rollback/OWNERS b/core/java/android/content/rollback/OWNERS
index 3093fd6..8e5a0d8 100644
--- a/core/java/android/content/rollback/OWNERS
+++ b/core/java/android/content/rollback/OWNERS
@@ -1,5 +1,5 @@
-# Bug component: 557916
+# Bug component: 819107
-narayan@google.com
-nandana@google.com
-olilan@google.com
+ancr@google.com
+harshitmahajan@google.com
+robertogil@google.com
diff --git a/core/java/android/os/GraphicsEnvironment.java b/core/java/android/os/GraphicsEnvironment.java
index 8fcff78..3149de4 100644
--- a/core/java/android/os/GraphicsEnvironment.java
+++ b/core/java/android/os/GraphicsEnvironment.java
@@ -673,6 +673,7 @@
if (anglePkg.isEmpty()) {
return;
}
+ intent.setPackage(anglePkg);
context.sendOrderedBroadcast(intent, null, new BroadcastReceiver() {
@Override
diff --git a/core/java/android/os/HwNoService.java b/core/java/android/os/HwNoService.java
index 117c3ad..0840314 100644
--- a/core/java/android/os/HwNoService.java
+++ b/core/java/android/os/HwNoService.java
@@ -16,37 +16,127 @@
package android.os;
+import android.hidl.manager.V1_2.IServiceManager;
+import android.util.Log;
+
+import java.util.ArrayList;
+
/**
* A fake hwservicemanager that is used locally when HIDL isn't supported on the device.
*
* @hide
*/
-final class HwNoService implements IHwBinder, IHwInterface {
- /** @hide */
- @Override
- public void transact(int code, HwParcel request, HwParcel reply, int flags) {}
+final class HwNoService extends IServiceManager.Stub implements IHwBinder, IHwInterface {
+ private static final String TAG = "HwNoService";
/** @hide */
@Override
- public IHwInterface queryLocalInterface(String descriptor) {
- return new HwNoService();
+ public String toString() {
+ return "[HwNoService]";
}
- /** @hide */
@Override
- public boolean linkToDeath(DeathRecipient recipient, long cookie) {
+ public android.hidl.base.V1_0.IBase get(String fqName, String name)
+ throws android.os.RemoteException {
+ Log.i(TAG, "get " + fqName + "/" + name + " with no hwservicemanager");
+ return null;
+ }
+
+ @Override
+ public boolean add(String name, android.hidl.base.V1_0.IBase service)
+ throws android.os.RemoteException {
+ Log.i(TAG, "get " + name + " with no hwservicemanager");
+ return false;
+ }
+
+ @Override
+ public byte getTransport(String fqName, String name) throws android.os.RemoteException {
+ Log.i(TAG, "getTransoport " + fqName + "/" + name + " with no hwservicemanager");
+ return 0x0;
+ }
+
+ @Override
+ public java.util.ArrayList<String> list() throws android.os.RemoteException {
+ Log.i(TAG, "list with no hwservicemanager");
+ return new ArrayList<String>();
+ }
+
+ @Override
+ public java.util.ArrayList<String> listByInterface(String fqName)
+ throws android.os.RemoteException {
+ Log.i(TAG, "listByInterface with no hwservicemanager");
+ return new ArrayList<String>();
+ }
+
+ @Override
+ public boolean registerForNotifications(
+ String fqName, String name, android.hidl.manager.V1_0.IServiceNotification callback)
+ throws android.os.RemoteException {
+ Log.i(TAG, "registerForNotifications with no hwservicemanager");
return true;
}
- /** @hide */
@Override
- public boolean unlinkToDeath(DeathRecipient recipient) {
+ public ArrayList<android.hidl.manager.V1_0.IServiceManager.InstanceDebugInfo> debugDump()
+ throws android.os.RemoteException {
+ Log.i(TAG, "debugDump with no hwservicemanager");
+ return new ArrayList<android.hidl.manager.V1_0.IServiceManager.InstanceDebugInfo>();
+ }
+
+ @Override
+ public void registerPassthroughClient(String fqName, String name)
+ throws android.os.RemoteException {
+ Log.i(TAG, "registerPassthroughClient with no hwservicemanager");
+ }
+
+ @Override
+ public boolean unregisterForNotifications(
+ String fqName, String name, android.hidl.manager.V1_0.IServiceNotification callback)
+ throws android.os.RemoteException {
+ Log.i(TAG, "unregisterForNotifications with no hwservicemanager");
return true;
}
- /** @hide */
@Override
- public IHwBinder asBinder() {
- return this;
+ public boolean registerClientCallback(
+ String fqName,
+ String name,
+ android.hidl.base.V1_0.IBase server,
+ android.hidl.manager.V1_2.IClientCallback cb)
+ throws android.os.RemoteException {
+ Log.i(
+ TAG,
+ "registerClientCallback for " + fqName + "/" + name + " with no hwservicemanager");
+ return true;
+ }
+
+ @Override
+ public boolean unregisterClientCallback(
+ android.hidl.base.V1_0.IBase server, android.hidl.manager.V1_2.IClientCallback cb)
+ throws android.os.RemoteException {
+ Log.i(TAG, "unregisterClientCallback with no hwservicemanager");
+ return true;
+ }
+
+ @Override
+ public boolean addWithChain(
+ String name, android.hidl.base.V1_0.IBase service, java.util.ArrayList<String> chain)
+ throws android.os.RemoteException {
+ Log.i(TAG, "addWithChain with no hwservicemanager");
+ return true;
+ }
+
+ @Override
+ public java.util.ArrayList<String> listManifestByInterface(String fqName)
+ throws android.os.RemoteException {
+ Log.i(TAG, "listManifestByInterface for " + fqName + " with no hwservicemanager");
+ return new ArrayList<String>();
+ }
+
+ @Override
+ public boolean tryUnregister(String fqName, String name, android.hidl.base.V1_0.IBase service)
+ throws android.os.RemoteException {
+ Log.i(TAG, "tryUnregister for " + fqName + "/" + name + " with no hwservicemanager");
+ return true;
}
}
diff --git a/core/java/android/security/responsible_apis_flags.aconfig b/core/java/android/security/responsible_apis_flags.aconfig
new file mode 100644
index 0000000..fe6c4a4
--- /dev/null
+++ b/core/java/android/security/responsible_apis_flags.aconfig
@@ -0,0 +1,29 @@
+package: "android.security"
+
+flag {
+ name: "extend_ecm_to_all_settings"
+ namespace: "responsible_apis"
+ description: "Allow all app settings to be restrictable via configuration"
+ bug: "297372999"
+}
+
+flag {
+ name: "asm_restrictions_enabled"
+ namespace: "responsible_apis"
+ description: "Enables ASM restrictions for activity starts and finishes"
+ bug: "230590090"
+}
+
+flag {
+ name: "asm_toasts_enabled"
+ namespace: "responsible_apis"
+ description: "Enables toasts when ASM restrictions are triggered"
+ bug: "230590090"
+}
+
+flag {
+ name: "content_uri_permission_apis"
+ namespace: "responsible_apis"
+ description: "Enables the content URI permission APIs"
+ bug: "293467489"
+}
diff --git a/core/jni/android_os_HwBinder.cpp b/core/jni/android_os_HwBinder.cpp
index 781895e..477bd09 100644
--- a/core/jni/android_os_HwBinder.cpp
+++ b/core/jni/android_os_HwBinder.cpp
@@ -258,14 +258,59 @@
JHwBinder::SetNativeContext(env, thiz, context);
}
-static void JHwBinder_native_transact(
- JNIEnv * /* env */,
- jobject /* thiz */,
- jint /* code */,
- jobject /* requestObj */,
- jobject /* replyObj */,
- jint /* flags */) {
- CHECK(!"Should not be here");
+static void JHwBinder_native_transact(JNIEnv *env, jobject thiz, jint code, jobject requestObj,
+ jobject replyObj, jint flags) {
+ if (requestObj == NULL) {
+ jniThrowException(env, "java/lang/NullPointerException", NULL);
+ return;
+ }
+ sp<hardware::IBinder> binder = JHwBinder::GetNativeBinder(env, thiz);
+ sp<android::hidl::base::V1_0::IBase> base = new android::hidl::base::V1_0::BpHwBase(binder);
+ hidl_string desc;
+ auto ret = base->interfaceDescriptor(
+ [&desc](const hidl_string &descriptor) { desc = descriptor; });
+ ret.assertOk();
+ // Only the fake hwservicemanager is allowed to be used locally like this.
+ if (desc != "android.hidl.manager@1.2::IServiceManager" &&
+ desc != "android.hidl.manager@1.1::IServiceManager" &&
+ desc != "android.hidl.manager@1.0::IServiceManager") {
+ LOG(FATAL) << "Local binders are not supported!";
+ }
+ if (replyObj == nullptr) {
+ LOG(FATAL) << "Unexpected null replyObj. code: " << code;
+ return;
+ }
+ const hardware::Parcel *request = JHwParcel::GetNativeContext(env, requestObj)->getParcel();
+ sp<JHwParcel> replyContext = JHwParcel::GetNativeContext(env, replyObj);
+ hardware::Parcel *reply = replyContext->getParcel();
+
+ request->setDataPosition(0);
+
+ bool isOneway = (flags & IBinder::FLAG_ONEWAY) != 0;
+ if (!isOneway) {
+ replyContext->setTransactCallback([](auto &replyParcel) {});
+ }
+
+ env->CallVoidMethod(thiz, gFields.onTransactID, code, requestObj, replyObj, flags);
+
+ if (env->ExceptionCheck()) {
+ jthrowable excep = env->ExceptionOccurred();
+ env->ExceptionDescribe();
+ env->ExceptionClear();
+
+ binder_report_exception(env, excep, "Uncaught error or exception in hwbinder!");
+
+ env->DeleteLocalRef(excep);
+ }
+
+ if (!isOneway) {
+ if (!replyContext->wasSent()) {
+ // The implementation never finished the transaction.
+ LOG(ERROR) << "The reply failed to send!";
+ }
+ }
+
+ reply->setDataPosition(0);
}
static void JHwBinder_native_registerService(
diff --git a/data/keyboards/Generic.kl b/data/keyboards/Generic.kl
index 31092536..51b720d 100644
--- a/data/keyboards/Generic.kl
+++ b/data/keyboards/Generic.kl
@@ -430,19 +430,17 @@
key 659 MACRO_4
# Keys defined by HID usages
-key usage 0x0c0067 WINDOW
-key usage 0x0c006F BRIGHTNESS_UP
-key usage 0x0c0070 BRIGHTNESS_DOWN
-key usage 0x0c0079 KEYBOARD_BACKLIGHT_UP
-key usage 0x0c007A KEYBOARD_BACKLIGHT_DOWN
-key usage 0x0c007C KEYBOARD_BACKLIGHT_TOGGLE
-key usage 0x0c0173 MEDIA_AUDIO_TRACK
-key usage 0x0c019C PROFILE_SWITCH
-key usage 0x0c01A2 ALL_APPS
-# TODO(b/297094448): Add stylus button mappings as a fallback when we have a way to determine
-# if a device can actually report it.
-# key usage 0x0d0044 STYLUS_BUTTON_PRIMARY
-# key usage 0x0d005a STYLUS_BUTTON_SECONDARY
+key usage 0x0c0067 WINDOW FALLBACK_USAGE_MAPPING
+key usage 0x0c006F BRIGHTNESS_UP FALLBACK_USAGE_MAPPING
+key usage 0x0c0070 BRIGHTNESS_DOWN FALLBACK_USAGE_MAPPING
+key usage 0x0c0079 KEYBOARD_BACKLIGHT_UP FALLBACK_USAGE_MAPPING
+key usage 0x0c007A KEYBOARD_BACKLIGHT_DOWN FALLBACK_USAGE_MAPPING
+key usage 0x0c007C KEYBOARD_BACKLIGHT_TOGGLE FALLBACK_USAGE_MAPPING
+key usage 0x0c0173 MEDIA_AUDIO_TRACK FALLBACK_USAGE_MAPPING
+key usage 0x0c019C PROFILE_SWITCH FALLBACK_USAGE_MAPPING
+key usage 0x0c01A2 ALL_APPS FALLBACK_USAGE_MAPPING
+key usage 0x0d0044 STYLUS_BUTTON_PRIMARY FALLBACK_USAGE_MAPPING
+key usage 0x0d005a STYLUS_BUTTON_SECONDARY FALLBACK_USAGE_MAPPING
# Joystick and game controller axes.
# Axes that are not mapped will be assigned generic axis numbers by the input subsystem.
diff --git a/packages/overlays/Android.bp b/packages/overlays/Android.bp
new file mode 100644
index 0000000..5e001fb
--- /dev/null
+++ b/packages/overlays/Android.bp
@@ -0,0 +1,44 @@
+// Copyright (C) 2019 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 {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: [
+ "frameworks_base_license",
+ ],
+}
+
+phony {
+ name: "frameworks-base-overlays",
+ required: [
+ "DisplayCutoutEmulationCornerOverlay",
+ "DisplayCutoutEmulationDoubleOverlay",
+ "DisplayCutoutEmulationHoleOverlay",
+ "DisplayCutoutEmulationTallOverlay",
+ "DisplayCutoutEmulationWaterfallOverlay",
+ "FontNotoSerifSourceOverlay",
+ "NavigationBarMode3ButtonOverlay",
+ "NavigationBarModeGesturalOverlay",
+ "NavigationBarModeGesturalOverlayNarrowBack",
+ "NavigationBarModeGesturalOverlayWideBack",
+ "NavigationBarModeGesturalOverlayExtraWideBack",
+ "TransparentNavigationBarOverlay",
+ "NotesRoleEnabledOverlay",
+ "preinstalled-packages-platform-overlays.xml",
+ ],
+}
+
+phony {
+ name: "frameworks-base-overlays-debug",
+}
diff --git a/packages/overlays/Android.mk b/packages/overlays/Android.mk
deleted file mode 100644
index a41d0e5..0000000
--- a/packages/overlays/Android.mk
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright (C) 2019 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.
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := frameworks-base-overlays
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../NOTICE
-LOCAL_REQUIRED_MODULES := \
- DisplayCutoutEmulationCornerOverlay \
- DisplayCutoutEmulationDoubleOverlay \
- DisplayCutoutEmulationHoleOverlay \
- DisplayCutoutEmulationTallOverlay \
- DisplayCutoutEmulationWaterfallOverlay \
- FontNotoSerifSourceOverlay \
- NavigationBarMode3ButtonOverlay \
- NavigationBarModeGesturalOverlay \
- NavigationBarModeGesturalOverlayNarrowBack \
- NavigationBarModeGesturalOverlayWideBack \
- NavigationBarModeGesturalOverlayExtraWideBack \
- TransparentNavigationBarOverlay \
- NotesRoleEnabledOverlay \
- preinstalled-packages-platform-overlays.xml
-
-include $(BUILD_PHONY_PACKAGE)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := frameworks-base-overlays-debug
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../NOTICE
-
-include $(BUILD_PHONY_PACKAGE)
-include $(call first-makefiles-under,$(LOCAL_PATH))
diff --git a/services/core/java/com/android/server/clipboard/ClipboardService.java b/services/core/java/com/android/server/clipboard/ClipboardService.java
index 74310b5..a895ac9 100644
--- a/services/core/java/com/android/server/clipboard/ClipboardService.java
+++ b/services/core/java/com/android/server/clipboard/ClipboardService.java
@@ -1344,7 +1344,11 @@
String defaultIme = Settings.Secure.getStringForUser(getContext().getContentResolver(),
Settings.Secure.DEFAULT_INPUT_METHOD, userId);
if (!TextUtils.isEmpty(defaultIme)) {
- final String imePkg = ComponentName.unflattenFromString(defaultIme).getPackageName();
+ final ComponentName imeComponent = ComponentName.unflattenFromString(defaultIme);
+ if (imeComponent == null) {
+ return false;
+ }
+ final String imePkg = imeComponent.getPackageName();
return imePkg.equals(packageName);
}
return false;
diff --git a/services/tests/mockingservicestests/Android.bp b/services/tests/mockingservicestests/Android.bp
index f56f290..8f25c0d 100644
--- a/services/tests/mockingservicestests/Android.bp
+++ b/services/tests/mockingservicestests/Android.bp
@@ -71,6 +71,7 @@
// TODO: remove once Android migrates to JUnit 4.12, which provides assertThrows
"testng",
"compatibility-device-util-axt",
+ "flag-junit",
],
libs: [