diff options
Diffstat (limited to 'cmds')
| -rw-r--r-- | cmds/abx/Android.bp | 7 | ||||
| -rwxr-xr-x | cmds/abx/abx.sh (renamed from cmds/abx/abx) | 0 | ||||
| -rwxr-xr-x | cmds/abx/abx2xml.sh (renamed from cmds/abx/abx2xml) | 0 | ||||
| -rwxr-xr-x | cmds/abx/xml2abx.sh (renamed from cmds/abx/xml2abx) | 0 | ||||
| -rw-r--r-- | cmds/am/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/am/am.sh (renamed from cmds/am/am) | 0 | ||||
| -rw-r--r-- | cmds/app_process/app_main.cpp | 2 | ||||
| -rw-r--r-- | cmds/appops/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/appops/appops.sh (renamed from cmds/appops/appops) | 0 | ||||
| -rw-r--r-- | cmds/appwidget/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/appwidget/appwidget.sh (renamed from cmds/appwidget/appwidget) | 0 | ||||
| -rw-r--r-- | cmds/bmgr/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/bmgr/bmgr.sh (renamed from cmds/bmgr/bmgr) | 0 | ||||
| -rw-r--r-- | cmds/bootanimation/BootAnimation.cpp | 3 | ||||
| -rw-r--r-- | cmds/bu/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/bu/bu.sh (renamed from cmds/bu/bu) | 0 | ||||
| -rw-r--r-- | cmds/content/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/content/content.sh (renamed from cmds/content/content) | 0 | ||||
| -rw-r--r-- | cmds/device_config/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/device_config/device_config.sh (renamed from cmds/device_config/device_config) | 0 | ||||
| -rw-r--r-- | cmds/dpm/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/dpm/dpm.sh (renamed from cmds/dpm/dpm) | 0 | ||||
| -rw-r--r-- | cmds/hid/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/hid/hid.sh (renamed from cmds/hid/hid) | 0 | ||||
| -rw-r--r-- | cmds/hid/jni/com_android_commands_hid_Device.cpp | 49 | ||||
| -rw-r--r-- | cmds/hid/jni/com_android_commands_hid_Device.h | 11 | ||||
| -rw-r--r-- | cmds/hid/src/com/android/commands/hid/Device.java | 88 | ||||
| -rw-r--r-- | cmds/hid/src/com/android/commands/hid/Event.java | 30 | ||||
| -rw-r--r-- | cmds/hid/src/com/android/commands/hid/Hid.java | 4 | ||||
| -rw-r--r-- | cmds/idmap2/Android.bp | 1 | ||||
| -rw-r--r-- | cmds/idmap2/include/idmap2/SysTrace.h | 15 | ||||
| -rw-r--r-- | cmds/idmap2/libidmap2/CommandLineOptions.cpp | 1 | ||||
| -rw-r--r-- | cmds/idmap2/libidmap2/Idmap.cpp | 1 | ||||
| -rw-r--r-- | cmds/idmap2/libidmap2/SysTrace.cpp | 36 | ||||
| -rw-r--r-- | cmds/ime/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/ime/ime.sh (renamed from cmds/ime/ime) | 0 | ||||
| -rw-r--r-- | cmds/incidentd/src/IncidentService.cpp | 6 | ||||
| -rw-r--r-- | cmds/input/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/input/input.sh (renamed from cmds/input/input) | 0 | ||||
| -rw-r--r-- | cmds/locksettings/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/locksettings/locksettings.sh (renamed from cmds/locksettings/locksettings) | 0 | ||||
| -rw-r--r-- | cmds/pm/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/pm/pm.sh (renamed from cmds/pm/pm) | 0 | ||||
| -rw-r--r-- | cmds/requestsync/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/requestsync/requestsync.sh (renamed from cmds/requestsync/requestsync) | 0 | ||||
| -rw-r--r-- | cmds/screencap/OWNERS | 2 | ||||
| -rw-r--r-- | cmds/settings/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/settings/settings.sh (renamed from cmds/settings/settings) | 0 | ||||
| -rw-r--r-- | cmds/sm/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/sm/sm.sh (renamed from cmds/sm/sm) | 0 | ||||
| -rw-r--r-- | cmds/sm/src/com/android/commands/sm/Sm.java | 14 | ||||
| -rw-r--r-- | cmds/svc/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/svc/svc.sh (renamed from cmds/svc/svc) | 0 | ||||
| -rw-r--r-- | cmds/telecom/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/telecom/telecom.sh (renamed from cmds/telecom/telecom) | 0 | ||||
| -rw-r--r-- | cmds/uiautomator/cmds/uiautomator/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/uiautomator/cmds/uiautomator/uiautomator.sh (renamed from cmds/uiautomator/cmds/uiautomator/uiautomator) | 0 | ||||
| -rw-r--r-- | cmds/uinput/Android.bp | 7 | ||||
| -rwxr-xr-x | cmds/uinput/uinput.sh (renamed from cmds/uinput/uinput) | 0 | ||||
| -rw-r--r-- | cmds/vr/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/vr/vr.sh (renamed from cmds/vr/vr) | 0 | ||||
| -rw-r--r-- | cmds/wm/Android.bp | 2 | ||||
| -rwxr-xr-x | cmds/wm/wm.sh (renamed from cmds/wm/wm) | 0 |
63 files changed, 227 insertions, 92 deletions
diff --git a/cmds/abx/Android.bp b/cmds/abx/Android.bp index 50a0b75b3276..a832dea20673 100644 --- a/cmds/abx/Android.bp +++ b/cmds/abx/Android.bp @@ -1,4 +1,3 @@ - package { default_applicable_licenses: ["frameworks_base_cmds_abx_license"], } @@ -18,7 +17,7 @@ license { java_binary { name: "abx", - wrapper: "abx", + wrapper: "abx.sh", srcs: ["**/*.java"], required: [ "abx2xml", @@ -28,10 +27,10 @@ java_binary { sh_binary { name: "abx2xml", - src: "abx2xml", + src: "abx2xml.sh", } sh_binary { name: "xml2abx", - src: "xml2abx", + src: "xml2abx.sh", } diff --git a/cmds/abx/abx b/cmds/abx/abx.sh index 0a9362d64398..0a9362d64398 100755 --- a/cmds/abx/abx +++ b/cmds/abx/abx.sh diff --git a/cmds/abx/abx2xml b/cmds/abx/abx2xml.sh index 0a9362d64398..0a9362d64398 100755 --- a/cmds/abx/abx2xml +++ b/cmds/abx/abx2xml.sh diff --git a/cmds/abx/xml2abx b/cmds/abx/xml2abx.sh index 0a9362d64398..0a9362d64398 100755 --- a/cmds/abx/xml2abx +++ b/cmds/abx/xml2abx.sh diff --git a/cmds/am/Android.bp b/cmds/am/Android.bp index 7bb9675ede37..c6cc7c55dae3 100644 --- a/cmds/am/Android.bp +++ b/cmds/am/Android.bp @@ -30,7 +30,7 @@ cc_library_host_static { java_binary { name: "am", - wrapper: "am", + wrapper: "am.sh", srcs: [ "src/**/*.java", "proto/**/*.proto", diff --git a/cmds/am/am b/cmds/am/am.sh index 54c2d394be2c..54c2d394be2c 100755 --- a/cmds/am/am +++ b/cmds/am/am.sh diff --git a/cmds/app_process/app_main.cpp b/cmds/app_process/app_main.cpp index 12083b6fe20b..28db61f7d98a 100644 --- a/cmds/app_process/app_main.cpp +++ b/cmds/app_process/app_main.cpp @@ -334,7 +334,7 @@ int main(int argc, char* const argv[]) if (zygote) { runtime.start("com.android.internal.os.ZygoteInit", args, zygote); - } else if (className) { + } else if (!className.isEmpty()) { runtime.start("com.android.internal.os.RuntimeInit", args, zygote); } else { fprintf(stderr, "Error: no class name or --zygote supplied.\n"); diff --git a/cmds/appops/Android.bp b/cmds/appops/Android.bp index 80f8ec679247..538ae941548e 100644 --- a/cmds/appops/Android.bp +++ b/cmds/appops/Android.bp @@ -19,5 +19,5 @@ license { sh_binary { name: "appops", - src: "appops", + src: "appops.sh", } diff --git a/cmds/appops/appops b/cmds/appops/appops.sh index 5dc85aa0979c..5dc85aa0979c 100755 --- a/cmds/appops/appops +++ b/cmds/appops/appops.sh diff --git a/cmds/appwidget/Android.bp b/cmds/appwidget/Android.bp index 8049038de809..cd439e2753e9 100644 --- a/cmds/appwidget/Android.bp +++ b/cmds/appwidget/Android.bp @@ -19,6 +19,6 @@ license { java_binary { name: "appwidget", - wrapper: "appwidget", + wrapper: "appwidget.sh", srcs: ["**/*.java"], } diff --git a/cmds/appwidget/appwidget b/cmds/appwidget/appwidget.sh index cc70ca53d5dd..cc70ca53d5dd 100755 --- a/cmds/appwidget/appwidget +++ b/cmds/appwidget/appwidget.sh diff --git a/cmds/bmgr/Android.bp b/cmds/bmgr/Android.bp index 14beb5561dba..a85669a20e99 100644 --- a/cmds/bmgr/Android.bp +++ b/cmds/bmgr/Android.bp @@ -20,6 +20,6 @@ license { java_binary { name: "bmgr", - wrapper: "bmgr", + wrapper: "bmgr.sh", srcs: ["**/*.java"], } diff --git a/cmds/bmgr/bmgr b/cmds/bmgr/bmgr.sh index b068d10dcbcf..b068d10dcbcf 100755 --- a/cmds/bmgr/bmgr +++ b/cmds/bmgr/bmgr.sh diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 50c8e933d25f..33739f39aaa4 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -510,7 +510,8 @@ status_t BootAnimation::readyToRun() { resolution = limitSurfaceSize(resolution.width, resolution.height); // create the native surface sp<SurfaceControl> control = session()->createSurface(String8("BootAnimation"), - resolution.getWidth(), resolution.getHeight(), PIXEL_FORMAT_RGB_565); + resolution.getWidth(), resolution.getHeight(), PIXEL_FORMAT_RGB_565, + ISurfaceComposerClient::eOpaque); SurfaceComposerClient::Transaction t; diff --git a/cmds/bu/Android.bp b/cmds/bu/Android.bp index 5b4ec3197cdd..b61a7a6e6429 100644 --- a/cmds/bu/Android.bp +++ b/cmds/bu/Android.bp @@ -20,6 +20,6 @@ license { java_binary { name: "bu", - wrapper: "bu", + wrapper: "bu.sh", srcs: ["**/*.java"], } diff --git a/cmds/bu/bu b/cmds/bu/bu.sh index e50b53da4325..e50b53da4325 100755 --- a/cmds/bu/bu +++ b/cmds/bu/bu.sh diff --git a/cmds/content/Android.bp b/cmds/content/Android.bp index c70d01ec8f0b..0dd0f034e405 100644 --- a/cmds/content/Android.bp +++ b/cmds/content/Android.bp @@ -19,6 +19,6 @@ license { java_binary { name: "content", - wrapper: "content", + wrapper: "content.sh", srcs: ["**/*.java"], } diff --git a/cmds/content/content b/cmds/content/content.sh index 91f2dfb16ac9..91f2dfb16ac9 100755 --- a/cmds/content/content +++ b/cmds/content/content.sh diff --git a/cmds/device_config/Android.bp b/cmds/device_config/Android.bp index 69572d8690c4..83b2730c874f 100644 --- a/cmds/device_config/Android.bp +++ b/cmds/device_config/Android.bp @@ -14,5 +14,5 @@ package { sh_binary { name: "device_config", - src: "device_config", + src: "device_config.sh", } diff --git a/cmds/device_config/device_config b/cmds/device_config/device_config.sh index a949bd528263..a949bd528263 100755 --- a/cmds/device_config/device_config +++ b/cmds/device_config/device_config.sh diff --git a/cmds/dpm/Android.bp b/cmds/dpm/Android.bp index 6819d0982d2c..29bee4958be6 100644 --- a/cmds/dpm/Android.bp +++ b/cmds/dpm/Android.bp @@ -20,5 +20,5 @@ license { sh_binary { name: "dpm", - src: "dpm", + src: "dpm.sh", } diff --git a/cmds/dpm/dpm b/cmds/dpm/dpm.sh index 784db5b352a9..784db5b352a9 100755 --- a/cmds/dpm/dpm +++ b/cmds/dpm/dpm.sh diff --git a/cmds/hid/Android.bp b/cmds/hid/Android.bp index 295c71c65368..a6e27698e36c 100644 --- a/cmds/hid/Android.bp +++ b/cmds/hid/Android.bp @@ -20,7 +20,7 @@ license { java_binary { name: "hid", - wrapper: "hid", + wrapper: "hid.sh", srcs: ["**/*.java"], required: ["libhidcommand_jni"], } diff --git a/cmds/hid/hid b/cmds/hid/hid.sh index 43c76345c9e1..43c76345c9e1 100755 --- a/cmds/hid/hid +++ b/cmds/hid/hid.sh diff --git a/cmds/hid/jni/com_android_commands_hid_Device.cpp b/cmds/hid/jni/com_android_commands_hid_Device.cpp index 2cda57dd67e9..8b8d361edbd4 100644 --- a/cmds/hid/jni/com_android_commands_hid_Device.cpp +++ b/cmds/hid/jni/com_android_commands_hid_Device.cpp @@ -18,24 +18,22 @@ #include "com_android_commands_hid_Device.h" -#include <linux/uhid.h> - +#include <android-base/stringprintf.h> +#include <android/looper.h> #include <fcntl.h> #include <inttypes.h> -#include <unistd.h> -#include <cstdio> -#include <cstring> -#include <memory> - -#include <android/looper.h> #include <jni.h> +#include <linux/uhid.h> #include <log/log.h> #include <nativehelper/JNIHelp.h> #include <nativehelper/ScopedLocalRef.h> #include <nativehelper/ScopedPrimitiveArray.h> #include <nativehelper/ScopedUtfChars.h> +#include <unistd.h> -#include <android-base/stringprintf.h> +#include <cstdio> +#include <cstring> +#include <memory> // Log debug messages about the output. static constexpr bool DEBUG_OUTPUT = false; @@ -109,15 +107,15 @@ void DeviceCallback::onDeviceOpen() { void DeviceCallback::onDeviceGetReport(uint32_t requestId, uint8_t reportId) { JNIEnv* env = getJNIEnv(); - env->CallVoidMethod(mCallbackObject, gDeviceCallbackClassInfo.onDeviceGetReport, - requestId, reportId); + env->CallVoidMethod(mCallbackObject, gDeviceCallbackClassInfo.onDeviceGetReport, requestId, + reportId); checkAndClearException(env, "onDeviceGetReport"); } -void DeviceCallback::onDeviceSetReport(uint8_t rType, - const std::vector<uint8_t>& data) { +void DeviceCallback::onDeviceSetReport(uint32_t id, uint8_t rType, + const std::vector<uint8_t>& data) { JNIEnv* env = getJNIEnv(); - env->CallVoidMethod(mCallbackObject, gDeviceCallbackClassInfo.onDeviceSetReport, rType, + env->CallVoidMethod(mCallbackObject, gDeviceCallbackClassInfo.onDeviceSetReport, id, rType, toJbyteArray(env, data).get()); checkAndClearException(env, "onDeviceSetReport"); } @@ -236,6 +234,14 @@ void Device::sendGetFeatureReportReply(uint32_t id, const std::vector<uint8_t>& writeEvent(mFd, ev, "UHID_GET_REPORT_REPLY"); } +void Device::sendSetReportReply(uint32_t id, bool success) const { + struct uhid_event ev = {}; + ev.type = UHID_SET_REPORT_REPLY; + ev.u.set_report_reply.id = id; + ev.u.set_report_reply.err = success ? 0 : EIO; + writeEvent(mFd, ev, "UHID_SET_REPORT_REPLY"); +} + int Device::handleEvents(int events) { if (events & (ALOOPER_EVENT_ERROR | ALOOPER_EVENT_HANGUP)) { ALOGE("uhid node was closed or an error occurred. events=0x%x", events); @@ -249,7 +255,6 @@ int Device::handleEvents(int events) { mDeviceCallback->onDeviceError(); return 0; } - switch (ev.type) { case UHID_OPEN: { mDeviceCallback->onDeviceOpen(); @@ -271,7 +276,7 @@ int Device::handleEvents(int events) { ALOGD("Received SET_REPORT: id=%" PRIu32 " rnum=%" PRIu8 " data=%s", set_report.id, set_report.rnum, toString(data).c_str()); } - mDeviceCallback->onDeviceSetReport(set_report.rtype, data); + mDeviceCallback->onDeviceSetReport(set_report.id, set_report.rtype, data); break; } case UHID_OUTPUT: { @@ -347,6 +352,15 @@ static void sendGetFeatureReportReply(JNIEnv* env, jclass /* clazz */, jlong ptr } } +static void sendSetReportReply(JNIEnv*, jclass /* clazz */, jlong ptr, jint id, jboolean success) { + uhid::Device* d = reinterpret_cast<uhid::Device*>(ptr); + if (d) { + d->sendSetReportReply(id, success); + } else { + ALOGE("Could not send set report reply, Device* is null!"); + } +} + static void closeDevice(JNIEnv* /* env */, jclass /* clazz */, jlong ptr) { uhid::Device* d = reinterpret_cast<uhid::Device*>(ptr); if (d) { @@ -362,6 +376,7 @@ static JNINativeMethod sMethods[] = { {"nativeSendReport", "(J[B)V", reinterpret_cast<void*>(sendReport)}, {"nativeSendGetFeatureReportReply", "(JI[B)V", reinterpret_cast<void*>(sendGetFeatureReportReply)}, + {"nativeSendSetReportReply", "(JIZ)V", reinterpret_cast<void*>(sendSetReportReply)}, {"nativeCloseDevice", "(J)V", reinterpret_cast<void*>(closeDevice)}, }; @@ -376,7 +391,7 @@ int register_com_android_commands_hid_Device(JNIEnv* env) { uhid::gDeviceCallbackClassInfo.onDeviceGetReport = env->GetMethodID(clazz, "onDeviceGetReport", "(II)V"); uhid::gDeviceCallbackClassInfo.onDeviceSetReport = - env->GetMethodID(clazz, "onDeviceSetReport", "(B[B)V"); + env->GetMethodID(clazz, "onDeviceSetReport", "(IB[B)V"); uhid::gDeviceCallbackClassInfo.onDeviceOutput = env->GetMethodID(clazz, "onDeviceOutput", "(B[B)V"); uhid::gDeviceCallbackClassInfo.onDeviceError = diff --git a/cmds/hid/jni/com_android_commands_hid_Device.h b/cmds/hid/jni/com_android_commands_hid_Device.h index d10a9aa3680c..9c6060d837e0 100644 --- a/cmds/hid/jni/com_android_commands_hid_Device.h +++ b/cmds/hid/jni/com_android_commands_hid_Device.h @@ -14,12 +14,11 @@ * limitations under the License. */ -#include <memory> -#include <vector> - +#include <android-base/unique_fd.h> #include <jni.h> -#include <android-base/unique_fd.h> +#include <memory> +#include <vector> namespace android { namespace uhid { @@ -31,7 +30,7 @@ public: void onDeviceOpen(); void onDeviceGetReport(uint32_t requestId, uint8_t reportId); - void onDeviceSetReport(uint8_t rType, const std::vector<uint8_t>& data); + void onDeviceSetReport(uint32_t id, uint8_t rType, const std::vector<uint8_t>& data); void onDeviceOutput(uint8_t rType, const std::vector<uint8_t>& data); void onDeviceError(); @@ -50,9 +49,9 @@ public: ~Device(); void sendReport(const std::vector<uint8_t>& report) const; + void sendSetReportReply(uint32_t id, bool success) const; void sendGetFeatureReportReply(uint32_t id, const std::vector<uint8_t>& report) const; void close(); - int handleEvents(int events); private: diff --git a/cmds/hid/src/com/android/commands/hid/Device.java b/cmds/hid/src/com/android/commands/hid/Device.java index 95b1e9a7b57f..0415037cfc9f 100644 --- a/cmds/hid/src/com/android/commands/hid/Device.java +++ b/cmds/hid/src/com/android/commands/hid/Device.java @@ -42,7 +42,8 @@ public class Device { private static final int MSG_OPEN_DEVICE = 1; private static final int MSG_SEND_REPORT = 2; private static final int MSG_SEND_GET_FEATURE_REPORT_REPLY = 3; - private static final int MSG_CLOSE_DEVICE = 4; + private static final int MSG_SEND_SET_REPORT_REPLY = 4; + private static final int MSG_CLOSE_DEVICE = 5; // Sync with linux uhid_event_type::UHID_OUTPUT private static final byte UHID_EVENT_TYPE_UHID_OUTPUT = 6; @@ -56,21 +57,45 @@ public class Device { private final Map<ByteBuffer, byte[]> mOutputs; private final OutputStream mOutputStream; private long mTimeToSend; - private final Object mCond = new Object(); + /** + * The report id of the report received in UHID_EVENT_TYPE_SET_REPORT. + * Used for SET_REPORT_REPLY. + * This field gets overridden each time SET_REPORT is received. + */ + private int mResponseId; static { System.loadLibrary("hidcommand_jni"); } - private static native long nativeOpenDevice(String name, int id, int vid, int pid, int bus, - byte[] descriptor, DeviceCallback callback); + private static native long nativeOpenDevice( + String name, + int id, + int vid, + int pid, + int bus, + byte[] descriptor, + DeviceCallback callback); + private static native void nativeSendReport(long ptr, byte[] data); + private static native void nativeSendGetFeatureReportReply(long ptr, int id, byte[] data); + + private static native void nativeSendSetReportReply(long ptr, int id, boolean success); + private static native void nativeCloseDevice(long ptr); - public Device(int id, String name, int vid, int pid, int bus, byte[] descriptor, - byte[] report, SparseArray<byte[]> featureReports, Map<ByteBuffer, byte[]> outputs) { + public Device( + int id, + String name, + int vid, + int pid, + int bus, + byte[] descriptor, + byte[] report, + SparseArray<byte[]> featureReports, + Map<ByteBuffer, byte[]> outputs) { mId = id; mThread = new HandlerThread("HidDeviceHandler"); mThread.start(); @@ -100,6 +125,17 @@ public class Device { mHandler.sendMessageAtTime(msg, mTimeToSend); } + public void setGetReportResponse(byte[] report) { + mFeatureReports.put(report[0], report); + } + + public void sendSetReportReply(boolean success) { + Message msg = + mHandler.obtainMessage(MSG_SEND_SET_REPORT_REPLY, mResponseId, success ? 1 : 0); + + mHandler.sendMessageAtTime(msg, mTimeToSend); + } + public void addDelay(int delay) { mTimeToSend = Math.max(SystemClock.uptimeMillis(), mTimeToSend) + delay; } @@ -111,7 +147,8 @@ public class Device { synchronized (mCond) { mCond.wait(); } - } catch (InterruptedException ignore) {} + } catch (InterruptedException ignore) { + } } private class DeviceHandler extends Handler { @@ -127,8 +164,15 @@ public class Device { switch (msg.what) { case MSG_OPEN_DEVICE: SomeArgs args = (SomeArgs) msg.obj; - mPtr = nativeOpenDevice((String) args.arg1, args.argi1, args.argi2, args.argi3, - args.argi4, (byte[]) args.arg2, new DeviceCallback()); + mPtr = + nativeOpenDevice( + (String) args.arg1, + args.argi1, + args.argi2, + args.argi3, + args.argi4, + (byte[]) args.arg2, + new DeviceCallback()); pauseEvents(); break; case MSG_SEND_REPORT: @@ -145,6 +189,14 @@ public class Device { Log.e(TAG, "Tried to send feature report reply to closed device."); } break; + case MSG_SEND_SET_REPORT_REPLY: + if (mPtr != 0) { + final boolean success = msg.arg2 == 1; + nativeSendSetReportReply(mPtr, msg.arg1, success); + } else { + Log.e(TAG, "Tried to send set report reply to closed device."); + } + break; case MSG_CLOSE_DEVICE: if (mPtr != 0) { nativeCloseDevice(mPtr); @@ -173,14 +225,18 @@ public class Device { } private class DeviceCallback { + public void onDeviceOpen() { mHandler.resumeEvents(); } public void onDeviceGetReport(int requestId, int reportId) { if (mFeatureReports == null) { - Log.e(TAG, "Received GET_REPORT request for reportId=" + reportId - + ", but 'feature_reports' section is not found"); + Log.e( + TAG, + "Received GET_REPORT request for reportId=" + + reportId + + ", but 'feature_reports' section is not found"); return; } byte[] report = mFeatureReports.get(reportId); @@ -220,14 +276,15 @@ public class Device { } catch (IOException e) { throw new RuntimeException(e); } - } // native callback - public void onDeviceSetReport(byte rtype, byte[] data) { + public void onDeviceSetReport(int id, byte rType, byte[] data) { + // Used by sendSetReportReply() + mResponseId = id; // We don't need to reply for the SET_REPORT but just send it to HID output for test // verification. - sendReportOutput(UHID_EVENT_TYPE_SET_REPORT, rtype, data); + sendReportOutput(UHID_EVENT_TYPE_SET_REPORT, rType, data); } // native callback @@ -239,7 +296,8 @@ public class Device { } byte[] response = mOutputs.get(ByteBuffer.wrap(data)); if (response == null) { - Log.i(TAG, + Log.i( + TAG, "Requested response for output " + Arrays.toString(data) + " is not found"); return; } diff --git a/cmds/hid/src/com/android/commands/hid/Event.java b/cmds/hid/src/com/android/commands/hid/Event.java index d4bf1d820a70..3efb79766b94 100644 --- a/cmds/hid/src/com/android/commands/hid/Event.java +++ b/cmds/hid/src/com/android/commands/hid/Event.java @@ -35,6 +35,8 @@ public class Event { public static final String COMMAND_REGISTER = "register"; public static final String COMMAND_DELAY = "delay"; public static final String COMMAND_REPORT = "report"; + public static final String COMMAND_SET_GET_REPORT_RESPONSE = "set_get_report_response"; + public static final String COMMAND_SEND_SET_REPORT_REPLY = "send_set_report_reply"; // These constants come from "include/uapi/linux/input.h" in the kernel enum Bus { @@ -62,6 +64,7 @@ public class Event { private SparseArray<byte[]> mFeatureReports; private Map<ByteBuffer, byte[]> mOutputs; private int mDuration; + private Boolean mReply; public int getId() { return mId; @@ -107,6 +110,10 @@ public class Event { return mDuration; } + public Boolean getReply() { + return mReply; + } + public String toString() { return "Event{id=" + mId + ", command=" + String.valueOf(mCommand) @@ -119,6 +126,7 @@ public class Event { + ", feature_reports=" + mFeatureReports.toString() + ", outputs=" + mOutputs.toString() + ", duration=" + mDuration + + ", success=" + mReply.toString() + "}"; } @@ -173,6 +181,10 @@ public class Event { mEvent.mDuration = duration; } + public void setReply(boolean success) { + mEvent.mReply = success; + } + public Event build() { if (mEvent.mId == -1) { throw new IllegalStateException("No event id"); @@ -183,6 +195,16 @@ public class Event { if (mEvent.mDescriptor == null) { throw new IllegalStateException("Device registration is missing descriptor"); } + } + if (COMMAND_SET_GET_REPORT_RESPONSE.equals(mEvent.mCommand)) { + if (mEvent.mReport == null) { + throw new IllegalStateException("Report command is missing response data"); + } + } + if (COMMAND_SEND_SET_REPORT_REPLY.equals(mEvent.mCommand)) { + if (mEvent.mReply == null) { + throw new IllegalStateException("Reply command is missing reply"); + } } else if (COMMAND_DELAY.equals(mEvent.mCommand)) { if (mEvent.mDuration <= 0) { throw new IllegalStateException("Delay has missing or invalid duration"); @@ -246,6 +268,9 @@ public class Event { case "duration": eb.setDuration(readInt()); break; + case "success": + eb.setReply(readBool()); + break; default: mReader.skipValue(); } @@ -292,6 +317,11 @@ public class Event { return Integer.decode(val); } + private boolean readBool() throws IOException { + String val = mReader.nextString(); + return Boolean.parseBoolean(val); + } + private Bus readBus() throws IOException { String val = mReader.nextString(); return Bus.valueOf(val.toUpperCase()); diff --git a/cmds/hid/src/com/android/commands/hid/Hid.java b/cmds/hid/src/com/android/commands/hid/Hid.java index fac0ab2ef125..2db791fe90bd 100644 --- a/cmds/hid/src/com/android/commands/hid/Hid.java +++ b/cmds/hid/src/com/android/commands/hid/Hid.java @@ -93,6 +93,10 @@ public class Hid { d.addDelay(e.getDuration()); } else if (Event.COMMAND_REPORT.equals(e.getCommand())) { d.sendReport(e.getReport()); + } else if (Event.COMMAND_SET_GET_REPORT_RESPONSE.equals(e.getCommand())) { + d.setGetReportResponse(e.getReport()); + } else if (Event.COMMAND_SEND_SET_REPORT_REPLY.equals(e.getCommand())) { + d.sendSetReportReply(e.getReply()); } else { if (Event.COMMAND_REGISTER.equals(e.getCommand())) { error("Device id=" + e.getId() + " is already registered. Ignoring event."); diff --git a/cmds/idmap2/Android.bp b/cmds/idmap2/Android.bp index 6ef6845c75f2..aa2113f931c3 100644 --- a/cmds/idmap2/Android.bp +++ b/cmds/idmap2/Android.bp @@ -41,6 +41,7 @@ cc_defaults { "-modernize-return-braced-init-list", "-modernize-use-default-member-init", "-modernize-use-equals-default", + "-modernize-use-emplace", "-modernize-use-nodiscard", "-modernize-use-override", "-modernize-use-trailing-return-type", diff --git a/cmds/idmap2/include/idmap2/SysTrace.h b/cmds/idmap2/include/idmap2/SysTrace.h index 19b4353def18..fcadf96a497f 100644 --- a/cmds/idmap2/include/idmap2/SysTrace.h +++ b/cmds/idmap2/include/idmap2/SysTrace.h @@ -17,8 +17,6 @@ #ifndef IDMAP2_INCLUDE_IDMAP2_SYSTRACE_H_ #define IDMAP2_INCLUDE_IDMAP2_SYSTRACE_H_ -#define ATRACE_TAG ATRACE_TAG_RRO - #include <sstream> #include <vector> @@ -29,16 +27,12 @@ namespace android::idmap2::utils { class ScopedTraceNoStart { public: - ~ScopedTraceNoStart() { - ATRACE_END(); - } + ~ScopedTraceNoStart(); }; class ScopedTraceMessageHelper { public: - ~ScopedTraceMessageHelper() { - ATRACE_BEGIN(buffer_.str().c_str()); - } + ~ScopedTraceMessageHelper(); std::ostream& stream() { return buffer_; @@ -48,9 +42,12 @@ class ScopedTraceMessageHelper { std::ostringstream buffer_; }; +bool atrace_enabled(); + #define SYSTRACE \ android::idmap2::utils::ScopedTraceNoStart _trace##__LINE__; \ - (ATRACE_ENABLED()) && android::idmap2::utils::ScopedTraceMessageHelper().stream() + android::idmap2::utils::atrace_enabled() \ + && android::idmap2::utils::ScopedTraceMessageHelper().stream() #else diff --git a/cmds/idmap2/libidmap2/CommandLineOptions.cpp b/cmds/idmap2/libidmap2/CommandLineOptions.cpp index 5b0ae92df887..8129d99650f7 100644 --- a/cmds/idmap2/libidmap2/CommandLineOptions.cpp +++ b/cmds/idmap2/libidmap2/CommandLineOptions.cpp @@ -17,6 +17,7 @@ #include "idmap2/CommandLineOptions.h" #include <algorithm> +#include <cassert> #include <iomanip> #include <iostream> #include <memory> diff --git a/cmds/idmap2/libidmap2/Idmap.cpp b/cmds/idmap2/libidmap2/Idmap.cpp index 6515d5516d83..06650f681b24 100644 --- a/cmds/idmap2/libidmap2/Idmap.cpp +++ b/cmds/idmap2/libidmap2/Idmap.cpp @@ -17,6 +17,7 @@ #include "idmap2/Idmap.h" #include <algorithm> +#include <cassert> #include <iostream> #include <iterator> #include <limits> diff --git a/cmds/idmap2/libidmap2/SysTrace.cpp b/cmds/idmap2/libidmap2/SysTrace.cpp new file mode 100644 index 000000000000..55d45b775ffa --- /dev/null +++ b/cmds/idmap2/libidmap2/SysTrace.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2022 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. + */ + +#define ATRACE_TAG ATRACE_TAG_RRO + +#include "idmap2/SysTrace.h" + +#ifdef __ANDROID__ +namespace android::idmap2::utils { + +ScopedTraceNoStart::~ScopedTraceNoStart() { + ATRACE_END(); +}; + +ScopedTraceMessageHelper::~ScopedTraceMessageHelper() { + ATRACE_BEGIN(buffer_.str().c_str()); +} + +bool atrace_enabled() { + return ATRACE_ENABLED(); +} +} // namespace android::idmap2::utils +#endif diff --git a/cmds/ime/Android.bp b/cmds/ime/Android.bp index 6dd3ba1ca7ef..5f54ffacbb00 100644 --- a/cmds/ime/Android.bp +++ b/cmds/ime/Android.bp @@ -20,5 +20,5 @@ license { sh_binary { name: "ime", - src: "ime", + src: "ime.sh", } diff --git a/cmds/ime/ime b/cmds/ime/ime.sh index 7d2f72f74010..7d2f72f74010 100755 --- a/cmds/ime/ime +++ b/cmds/ime/ime.sh diff --git a/cmds/incidentd/src/IncidentService.cpp b/cmds/incidentd/src/IncidentService.cpp index fbb99d2aea89..5af02f405ed9 100644 --- a/cmds/incidentd/src/IncidentService.cpp +++ b/cmds/incidentd/src/IncidentService.cpp @@ -47,10 +47,12 @@ enum { #define DEFAULT_REFACTORY_PERIOD_MS (24 * 60 * 60 * 1000) // 1 Day // Skip these sections (for dumpstate only) -// Skip logs (1100 - 1108) and traces (1200 - 1202) because they are already in the bug report. +// Skip logs (1100 - 1108), traces (1200 - 1202), dumpsys (3000 - 3024, 3027 - 3056, 4000 - 4001) +// because they are already in the bug report. #define SKIPPED_DUMPSTATE_SECTIONS { \ 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, /* Logs */ \ - 1200, 1201, 1202, /* Native, hal, java traces */ } + 1200, 1201, 1202, /* Native, hal, java traces */ \ + 3018, /* dumpsys meminfo*/ } namespace android { namespace os { diff --git a/cmds/input/Android.bp b/cmds/input/Android.bp index 2e30176971d7..8f44f3e34ef7 100644 --- a/cmds/input/Android.bp +++ b/cmds/input/Android.bp @@ -20,5 +20,5 @@ license { sh_binary { name: "input", - src: "input", + src: "input.sh", } diff --git a/cmds/input/input b/cmds/input/input.sh index d7d041431b49..d7d041431b49 100755 --- a/cmds/input/input +++ b/cmds/input/input.sh diff --git a/cmds/locksettings/Android.bp b/cmds/locksettings/Android.bp index 3869c8fcdabc..5ee582450361 100644 --- a/cmds/locksettings/Android.bp +++ b/cmds/locksettings/Android.bp @@ -23,6 +23,6 @@ package { java_binary { name: "locksettings", - wrapper: "locksettings", + wrapper: "locksettings.sh", srcs: ["**/*.java"], } diff --git a/cmds/locksettings/locksettings b/cmds/locksettings/locksettings.sh index 0ef4fa9f6771..0ef4fa9f6771 100755 --- a/cmds/locksettings/locksettings +++ b/cmds/locksettings/locksettings.sh diff --git a/cmds/pm/Android.bp b/cmds/pm/Android.bp index 847dbabdf4c0..0e61a9e35d5e 100644 --- a/cmds/pm/Android.bp +++ b/cmds/pm/Android.bp @@ -20,5 +20,5 @@ license { sh_binary { name: "pm", - src: "pm", + src: "pm.sh", } diff --git a/cmds/pm/pm b/cmds/pm/pm.sh index 4d1f94554a78..4d1f94554a78 100755 --- a/cmds/pm/pm +++ b/cmds/pm/pm.sh diff --git a/cmds/requestsync/Android.bp b/cmds/requestsync/Android.bp index 57e8dd355b26..8718f79c0d70 100644 --- a/cmds/requestsync/Android.bp +++ b/cmds/requestsync/Android.bp @@ -20,6 +20,6 @@ license { java_binary { name: "requestsync", - wrapper: "requestsync", + wrapper: "requestsync.sh", srcs: ["**/*.java"], } diff --git a/cmds/requestsync/requestsync b/cmds/requestsync/requestsync.sh index 2d5d0e41705a..2d5d0e41705a 100755 --- a/cmds/requestsync/requestsync +++ b/cmds/requestsync/requestsync.sh diff --git a/cmds/screencap/OWNERS b/cmds/screencap/OWNERS new file mode 100644 index 000000000000..89f117782844 --- /dev/null +++ b/cmds/screencap/OWNERS @@ -0,0 +1,2 @@ +include /graphics/java/android/graphics/OWNERS +include /services/core/java/com/android/server/wm/OWNERS diff --git a/cmds/settings/Android.bp b/cmds/settings/Android.bp index cc730062f9df..8180fd6cab61 100644 --- a/cmds/settings/Android.bp +++ b/cmds/settings/Android.bp @@ -14,5 +14,5 @@ package { sh_binary { name: "settings", - src: "settings", + src: "settings.sh", } diff --git a/cmds/settings/settings b/cmds/settings/settings.sh index d41ccc62811a..d41ccc62811a 100755 --- a/cmds/settings/settings +++ b/cmds/settings/settings.sh diff --git a/cmds/sm/Android.bp b/cmds/sm/Android.bp index ecfacaeecfd9..403022a2d2ae 100644 --- a/cmds/sm/Android.bp +++ b/cmds/sm/Android.bp @@ -20,6 +20,6 @@ license { java_binary { name: "sm", - wrapper: "sm", + wrapper: "sm.sh", srcs: ["**/*.java"], } diff --git a/cmds/sm/sm b/cmds/sm/sm.sh index 30eae00a990d..30eae00a990d 100755 --- a/cmds/sm/sm +++ b/cmds/sm/sm.sh diff --git a/cmds/sm/src/com/android/commands/sm/Sm.java b/cmds/sm/src/com/android/commands/sm/Sm.java index b384e702ac4e..07c407933dc5 100644 --- a/cmds/sm/src/com/android/commands/sm/Sm.java +++ b/cmds/sm/src/com/android/commands/sm/Sm.java @@ -94,8 +94,6 @@ public final class Sm { runBenchmark(); } else if ("forget".equals(op)) { runForget(); - } else if ("set-emulate-fbe".equals(op)) { - runSetEmulateFbe(); } else if ("get-fbe-mode".equals(op)) { runGetFbeMode(); } else if ("idle-maint".equals(op)) { @@ -191,17 +189,9 @@ public final class Sm { } } - public void runSetEmulateFbe() throws RemoteException { - final boolean emulateFbe = Boolean.parseBoolean(nextArg()); - mSm.setDebugFlags(emulateFbe ? StorageManager.DEBUG_EMULATE_FBE : 0, - StorageManager.DEBUG_EMULATE_FBE); - } - public void runGetFbeMode() { - if (StorageManager.isFileEncryptedNativeOnly()) { + if (StorageManager.isFileEncrypted()) { System.out.println("native"); - } else if (StorageManager.isFileEncryptedEmulatedOnly()) { - System.out.println("emulated"); } else { System.out.println("none"); } @@ -358,8 +348,6 @@ public final class Sm { System.err.println(""); System.err.println(" sm forget [UUID|all]"); System.err.println(""); - System.err.println(" sm set-emulate-fbe [true|false]"); - System.err.println(""); System.err.println(" sm start-checkpoint <num-retries>"); System.err.println(""); System.err.println(" sm supports-checkpoint"); diff --git a/cmds/svc/Android.bp b/cmds/svc/Android.bp index 41a3ebd2f514..a2460875f28e 100644 --- a/cmds/svc/Android.bp +++ b/cmds/svc/Android.bp @@ -20,6 +20,6 @@ license { java_binary { name: "svc", - wrapper: "svc", + wrapper: "svc.sh", srcs: ["**/*.java"], } diff --git a/cmds/svc/svc b/cmds/svc/svc.sh index a2c9de32b3d0..a2c9de32b3d0 100755 --- a/cmds/svc/svc +++ b/cmds/svc/svc.sh diff --git a/cmds/telecom/Android.bp b/cmds/telecom/Android.bp index 4da79c54477b..be027105ae98 100644 --- a/cmds/telecom/Android.bp +++ b/cmds/telecom/Android.bp @@ -20,6 +20,6 @@ license { java_binary { name: "telecom", - wrapper: "telecom", + wrapper: "telecom.sh", srcs: ["**/*.java"], } diff --git a/cmds/telecom/telecom b/cmds/telecom/telecom.sh index a19036bf5bd8..a19036bf5bd8 100755 --- a/cmds/telecom/telecom +++ b/cmds/telecom/telecom.sh diff --git a/cmds/uiautomator/cmds/uiautomator/Android.bp b/cmds/uiautomator/cmds/uiautomator/Android.bp index 56e2e70958fa..51323860725b 100644 --- a/cmds/uiautomator/cmds/uiautomator/Android.bp +++ b/cmds/uiautomator/cmds/uiautomator/Android.bp @@ -25,7 +25,7 @@ package { java_binary { name: "uiautomator", - wrapper: "uiautomator", + wrapper: "uiautomator.sh", srcs: ["src/**/*.java"], static_libs: ["uiautomator.core"], } diff --git a/cmds/uiautomator/cmds/uiautomator/uiautomator b/cmds/uiautomator/cmds/uiautomator/uiautomator.sh index 889c2b524dfd..889c2b524dfd 100755 --- a/cmds/uiautomator/cmds/uiautomator/uiautomator +++ b/cmds/uiautomator/cmds/uiautomator/uiautomator.sh diff --git a/cmds/uinput/Android.bp b/cmds/uinput/Android.bp index 260cfc781ebc..4b08d968ac4a 100644 --- a/cmds/uinput/Android.bp +++ b/cmds/uinput/Android.bp @@ -20,9 +20,10 @@ license { java_binary { name: "uinput", - wrapper: "uinput", - srcs: ["**/*.java", - ":uinputcommand_aidl" + wrapper: "uinput.sh", + srcs: [ + "**/*.java", + ":uinputcommand_aidl", ], required: ["libuinputcommand_jni"], } diff --git a/cmds/uinput/uinput b/cmds/uinput/uinput.sh index ab2770ee2043..ab2770ee2043 100755 --- a/cmds/uinput/uinput +++ b/cmds/uinput/uinput.sh diff --git a/cmds/vr/Android.bp b/cmds/vr/Android.bp index 893649155fd8..61795b4cc052 100644 --- a/cmds/vr/Android.bp +++ b/cmds/vr/Android.bp @@ -20,6 +20,6 @@ license { java_binary { name: "vr", - wrapper: "vr", + wrapper: "vr.sh", srcs: ["**/*.java"], } diff --git a/cmds/vr/vr b/cmds/vr/vr.sh index dbde02a4ac7f..dbde02a4ac7f 100755 --- a/cmds/vr/vr +++ b/cmds/vr/vr.sh diff --git a/cmds/wm/Android.bp b/cmds/wm/Android.bp index cf6b0193fe87..4d00f175211d 100644 --- a/cmds/wm/Android.bp +++ b/cmds/wm/Android.bp @@ -20,5 +20,5 @@ license { sh_binary { name: "wm", - src: "wm", + src: "wm.sh", } diff --git a/cmds/wm/wm b/cmds/wm/wm.sh index cb45be20c24a..cb45be20c24a 100755 --- a/cmds/wm/wm +++ b/cmds/wm/wm.sh |