Loading data/etc/android.hardware.telephony.cdma.xml +1 −0 Original line number Diff line number Diff line Loading @@ -18,4 +18,5 @@ <permissions> <feature name="android.hardware.telephony" /> <feature name="android.hardware.telephony.cdma" /> <feature name="android.hardware.telephony.data" /> </permissions> data/etc/android.hardware.telephony.gsm.xml +1 −0 Original line number Diff line number Diff line Loading @@ -18,4 +18,5 @@ <permissions> <feature name="android.hardware.telephony" /> <feature name="android.hardware.telephony.gsm" /> <feature name="android.hardware.telephony.data" /> </permissions> libs/android_runtime_lazy/android_runtime_lazy.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ #define LOG_TAG "ANDROID_RUNTIME_LAZY" #include "android_runtime/AndroidRuntime.h" #include "android_os_Parcel.h" #include "android_util_Binder.h" #include <dlfcn.h> Loading @@ -28,12 +29,18 @@ namespace { std::once_flag loadFlag; typedef JNIEnv* (*getJNIEnv_t)(); // android_util_Binder.h typedef sp<IBinder> (*ibinderForJavaObject_t)(JNIEnv* env, jobject obj); typedef jobject (*javaObjectForIBinder_t)(JNIEnv* env, const sp<IBinder>& val); // android_os_Parcel.h typedef Parcel* (*parcelForJavaObject_t)(JNIEnv* env, jobject obj); getJNIEnv_t _getJNIEnv; ibinderForJavaObject_t _ibinderForJavaObject; javaObjectForIBinder_t _javaObjectForIBinder; parcelForJavaObject_t _parcelForJavaObject; void load() { std::call_once(loadFlag, []() { Loading Loading @@ -64,6 +71,13 @@ void load() { ALOGW("Could not find javaObjectForIBinder."); // no return } _parcelForJavaObject = reinterpret_cast<parcelForJavaObject_t>( dlsym(handle, "_ZN7android19parcelForJavaObjectEP7_JNIEnvP8_jobject")); if (_parcelForJavaObject == nullptr) { ALOGW("Could not find parcelForJavaObject."); // no return } }); } Loading Loading @@ -95,4 +109,12 @@ jobject javaObjectForIBinder(JNIEnv* env, const sp<IBinder>& val) { return _javaObjectForIBinder(env, val); } Parcel* parcelForJavaObject(JNIEnv* env, jobject obj) { load(); if (_parcelForJavaObject == nullptr) { return nullptr; } return _parcelForJavaObject(env, obj); } } // namespace android libs/android_runtime_lazy/include/android_os_Parcel.h 0 → 100644 +30 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 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. */ #pragma once #include <binder/Parcel.h> #include "jni.h" namespace android { // The name of this file is same with the file in frameworks/base/core/jni/ // This is intentional to make the client use these exported functions // in the same way with the original. Parcel* parcelForJavaObject(JNIEnv* env, jobject obj); } // namespace android libs/binder/ndk/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ cc_library { "ibinder.cpp", "ibinder_jni.cpp", "parcel.cpp", "parcel_jni.cpp", "process.cpp", "stability.cpp", "status.cpp", Loading Loading
data/etc/android.hardware.telephony.cdma.xml +1 −0 Original line number Diff line number Diff line Loading @@ -18,4 +18,5 @@ <permissions> <feature name="android.hardware.telephony" /> <feature name="android.hardware.telephony.cdma" /> <feature name="android.hardware.telephony.data" /> </permissions>
data/etc/android.hardware.telephony.gsm.xml +1 −0 Original line number Diff line number Diff line Loading @@ -18,4 +18,5 @@ <permissions> <feature name="android.hardware.telephony" /> <feature name="android.hardware.telephony.gsm" /> <feature name="android.hardware.telephony.data" /> </permissions>
libs/android_runtime_lazy/android_runtime_lazy.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ #define LOG_TAG "ANDROID_RUNTIME_LAZY" #include "android_runtime/AndroidRuntime.h" #include "android_os_Parcel.h" #include "android_util_Binder.h" #include <dlfcn.h> Loading @@ -28,12 +29,18 @@ namespace { std::once_flag loadFlag; typedef JNIEnv* (*getJNIEnv_t)(); // android_util_Binder.h typedef sp<IBinder> (*ibinderForJavaObject_t)(JNIEnv* env, jobject obj); typedef jobject (*javaObjectForIBinder_t)(JNIEnv* env, const sp<IBinder>& val); // android_os_Parcel.h typedef Parcel* (*parcelForJavaObject_t)(JNIEnv* env, jobject obj); getJNIEnv_t _getJNIEnv; ibinderForJavaObject_t _ibinderForJavaObject; javaObjectForIBinder_t _javaObjectForIBinder; parcelForJavaObject_t _parcelForJavaObject; void load() { std::call_once(loadFlag, []() { Loading Loading @@ -64,6 +71,13 @@ void load() { ALOGW("Could not find javaObjectForIBinder."); // no return } _parcelForJavaObject = reinterpret_cast<parcelForJavaObject_t>( dlsym(handle, "_ZN7android19parcelForJavaObjectEP7_JNIEnvP8_jobject")); if (_parcelForJavaObject == nullptr) { ALOGW("Could not find parcelForJavaObject."); // no return } }); } Loading Loading @@ -95,4 +109,12 @@ jobject javaObjectForIBinder(JNIEnv* env, const sp<IBinder>& val) { return _javaObjectForIBinder(env, val); } Parcel* parcelForJavaObject(JNIEnv* env, jobject obj) { load(); if (_parcelForJavaObject == nullptr) { return nullptr; } return _parcelForJavaObject(env, obj); } } // namespace android
libs/android_runtime_lazy/include/android_os_Parcel.h 0 → 100644 +30 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 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. */ #pragma once #include <binder/Parcel.h> #include "jni.h" namespace android { // The name of this file is same with the file in frameworks/base/core/jni/ // This is intentional to make the client use these exported functions // in the same way with the original. Parcel* parcelForJavaObject(JNIEnv* env, jobject obj); } // namespace android
libs/binder/ndk/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ cc_library { "ibinder.cpp", "ibinder_jni.cpp", "parcel.cpp", "parcel_jni.cpp", "process.cpp", "stability.cpp", "status.cpp", Loading