diff options
Diffstat (limited to 'cmds')
| -rw-r--r-- | cmds/am/src/com/android/commands/am/Am.java | 31 | ||||
| -rw-r--r-- | cmds/am/src/com/android/commands/am/Instrument.java | 2 | ||||
| -rw-r--r-- | cmds/bootanimation/BootAnimation.cpp | 12 | ||||
| -rw-r--r-- | cmds/idmap2/Android.bp | 7 | ||||
| -rw-r--r-- | cmds/idmap2/OWNERS | 4 | ||||
| -rw-r--r-- | cmds/idmap2/idmap2d/Idmap2Service.cpp | 2 | ||||
| -rw-r--r-- | cmds/idmap2/include/idmap2/FileUtils.h | 2 | ||||
| -rw-r--r-- | cmds/idmap2/tests/Idmap2BinaryTests.cpp | 44 | ||||
| -rw-r--r-- | cmds/idmap2/tests/IdmapTests.cpp | 1 | ||||
| -rw-r--r-- | cmds/idmap2/tests/ResourceMappingTests.cpp | 2 | ||||
| -rw-r--r-- | cmds/incidentd/src/WorkDirectory.cpp | 2 | ||||
| -rw-r--r-- | cmds/svc/src/com/android/commands/svc/BluetoothCommand.java | 58 | ||||
| -rw-r--r-- | cmds/svc/src/com/android/commands/svc/Svc.java | 2 | ||||
| -rwxr-xr-x | cmds/svc/svc | 19 |
14 files changed, 82 insertions, 106 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java index 4e46aa3f42d5..9564dde7fe06 100644 --- a/cmds/am/src/com/android/commands/am/Am.java +++ b/cmds/am/src/com/android/commands/am/Am.java @@ -41,6 +41,10 @@ public class Am extends BaseCommand { private IActivityManager mAm; private IPackageManager mPm; + Am() { + svcInit(); + } + /** * Command-line entry point. * @@ -50,6 +54,20 @@ public class Am extends BaseCommand { (new Am()).run(args); } + private void svcInit() { + mAm = ActivityManager.getService(); + if (mAm == null) { + System.err.println(NO_SYSTEM_ERROR_CODE); + return; + } + + mPm = IPackageManager.Stub.asInterface(ServiceManager.getService("package")); + if (mPm == null) { + System.err.println(NO_SYSTEM_ERROR_CODE); + return; + } + } + @Override public void onShowUsage(PrintStream out) { try { @@ -61,19 +79,6 @@ public class Am extends BaseCommand { @Override public void onRun() throws Exception { - - mAm = ActivityManager.getService(); - if (mAm == null) { - System.err.println(NO_SYSTEM_ERROR_CODE); - throw new AndroidException("Can't connect to activity manager; is the system running?"); - } - - mPm = IPackageManager.Stub.asInterface(ServiceManager.getService("package")); - if (mPm == null) { - System.err.println(NO_SYSTEM_ERROR_CODE); - throw new AndroidException("Can't connect to package manager; is the system running?"); - } - String op = nextArgRequired(); if (op.equals("instrument")) { diff --git a/cmds/am/src/com/android/commands/am/Instrument.java b/cmds/am/src/com/android/commands/am/Instrument.java index 1e72ddf8ecfc..0b439df403e0 100644 --- a/cmds/am/src/com/android/commands/am/Instrument.java +++ b/cmds/am/src/com/android/commands/am/Instrument.java @@ -545,6 +545,8 @@ public class Instrument { mWm.setAnimationScales(oldAnims); } } + // Exit from here instead of going down the path of normal shutdown which is slow. + System.exit(0); } private static String readLogcat(long startTimeMs) { diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 6c8cab7783b6..52fd7be0d768 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -764,6 +764,7 @@ bool BootAnimation::threadLoop() { // We have no bootanimation file, so we use the stock android logo // animation. if (mZipFileName.isEmpty()) { + ALOGD("No animation file"); result = android(); } else { result = movie(); @@ -1474,6 +1475,10 @@ bool BootAnimation::playAnimation(const Animation& animation) { part.backgroundColor[2], 1.0f); + ALOGD("Playing files = %s/%s, Requested repeat = %d, playUntilComplete = %s", + animation.fileName.string(), part.path.string(), part.count, + part.playUntilComplete ? "true" : "false"); + // For the last animation, if we have progress indicator from // the system, display it. int currentProgress = android::base::GetIntProperty(PROGRESS_PROP_NAME, 0); @@ -1577,7 +1582,7 @@ bool BootAnimation::playAnimation(const Animation& animation) { int err; do { err = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &spec, nullptr); - } while (err<0 && errno == EINTR); + } while (err == EINTR); } checkExit(); @@ -1607,6 +1612,9 @@ bool BootAnimation::playAnimation(const Animation& animation) { } } + ALOGD("%sAnimationShownTiming End time: %" PRId64 "ms", mShuttingDown ? "Shutdown" : "Boot", + elapsedRealtime()); + return true; } @@ -1682,6 +1690,8 @@ BootAnimation::Animation* BootAnimation::loadAnimation(const String8& fn) { return nullptr; } + ALOGD("%s is loaded successfully", fn.string()); + Animation *animation = new Animation; animation->fileName = fn; animation->zip = zip; diff --git a/cmds/idmap2/Android.bp b/cmds/idmap2/Android.bp index de1bcaea079c..c202f6f03b5b 100644 --- a/cmds/idmap2/Android.bp +++ b/cmds/idmap2/Android.bp @@ -35,8 +35,11 @@ cc_defaults { tidy_checks_as_errors: [ "modernize-*", "-modernize-avoid-c-arrays", + "-modernize-concat-nested-namespaces", "-modernize-pass-by-value", "-modernize-replace-disallow-copy-and-assign-macro", + "-modernize-return-braced-init-list", + "-modernize-use-default-member-init", "-modernize-use-equals-default", "-modernize-use-nodiscard", "-modernize-use-override", @@ -50,13 +53,11 @@ cc_defaults { "-readability-const-return-type", "-readability-convert-member-functions-to-static", "-readability-else-after-return", + "-readability-identifier-length", "-readability-named-parameter", "-readability-redundant-access-specifiers", "-readability-uppercase-literal-suffix", ], - tidy_flags: [ - "-system-headers", - ], } cc_library { diff --git a/cmds/idmap2/OWNERS b/cmds/idmap2/OWNERS index 69dfcc98340d..062ffd41348a 100644 --- a/cmds/idmap2/OWNERS +++ b/cmds/idmap2/OWNERS @@ -1,4 +1,4 @@ set noparent toddke@google.com -rtmitchell@google.com -patb@google.com
\ No newline at end of file +patb@google.com +zyy@google.com diff --git a/cmds/idmap2/idmap2d/Idmap2Service.cpp b/cmds/idmap2/idmap2d/Idmap2Service.cpp index a8d648917b08..1b2d905aec0a 100644 --- a/cmds/idmap2/idmap2d/Idmap2Service.cpp +++ b/cmds/idmap2/idmap2d/Idmap2Service.cpp @@ -39,11 +39,9 @@ #include "idmap2/Result.h" #include "idmap2/SysTrace.h" -using android::IPCThreadState; using android::base::StringPrintf; using android::binder::Status; using android::idmap2::BinaryStreamVisitor; -using android::idmap2::FabricatedOverlay; using android::idmap2::FabricatedOverlayContainer; using android::idmap2::Idmap; using android::idmap2::IdmapHeader; diff --git a/cmds/idmap2/include/idmap2/FileUtils.h b/cmds/idmap2/include/idmap2/FileUtils.h index 2588688de44c..bc0bb47fc2b7 100644 --- a/cmds/idmap2/include/idmap2/FileUtils.h +++ b/cmds/idmap2/include/idmap2/FileUtils.h @@ -17,6 +17,8 @@ #ifndef IDMAP2_INCLUDE_IDMAP2_FILEUTILS_H_ #define IDMAP2_INCLUDE_IDMAP2_FILEUTILS_H_ +#include <sys/types.h> + #include <random> #include <string> diff --git a/cmds/idmap2/tests/Idmap2BinaryTests.cpp b/cmds/idmap2/tests/Idmap2BinaryTests.cpp index a55b41b83c93..1c8259746189 100644 --- a/cmds/idmap2/tests/Idmap2BinaryTests.cpp +++ b/cmds/idmap2/tests/Idmap2BinaryTests.cpp @@ -96,7 +96,7 @@ TEST_F(Idmap2BinaryTests, Create) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); - ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; + ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; struct stat st; ASSERT_EQ(stat(GetIdmapPath().c_str(), &st), 0); @@ -123,7 +123,7 @@ TEST_F(Idmap2BinaryTests, Dump) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); - ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; + ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; // clang-format off result = ExecuteBinary({"idmap2", @@ -131,24 +131,24 @@ TEST_F(Idmap2BinaryTests, Dump) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); - ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; + ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; - ASSERT_NE(result->stdout.find(StringPrintf("0x%08x -> 0x%08x", R::target::integer::int1, + ASSERT_NE(result->stdout_str.find(StringPrintf("0x%08x -> 0x%08x", R::target::integer::int1, R::overlay::integer::int1)), std::string::npos) - << result->stdout; - ASSERT_NE(result->stdout.find(StringPrintf("0x%08x -> 0x%08x", R::target::string::str1, + << result->stdout_str; + ASSERT_NE(result->stdout_str.find(StringPrintf("0x%08x -> 0x%08x", R::target::string::str1, R::overlay::string::str1)), std::string::npos) - << result->stdout; - ASSERT_NE(result->stdout.find(StringPrintf("0x%08x -> 0x%08x", R::target::string::str3, + << result->stdout_str; + ASSERT_NE(result->stdout_str.find(StringPrintf("0x%08x -> 0x%08x", R::target::string::str3, R::overlay::string::str3)), std::string::npos) - << result->stdout; - ASSERT_NE(result->stdout.find(StringPrintf("0x%08x -> 0x%08x", R::target::string::str4, + << result->stdout_str; + ASSERT_NE(result->stdout_str.find(StringPrintf("0x%08x -> 0x%08x", R::target::string::str4, R::overlay::string::str4)), std::string::npos) - << result->stdout; + << result->stdout_str; // clang-format off result = ExecuteBinary({"idmap2", @@ -157,8 +157,8 @@ TEST_F(Idmap2BinaryTests, Dump) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); - ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; - ASSERT_NE(result->stdout.find("00000000: 504d4449 magic"), std::string::npos); + ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; + ASSERT_NE(result->stdout_str.find("00000000: 504d4449 magic"), std::string::npos); // clang-format off result = ExecuteBinary({"idmap2", @@ -184,7 +184,7 @@ TEST_F(Idmap2BinaryTests, Lookup) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); - ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; + ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; // clang-format off result = ExecuteBinary({"idmap2", @@ -194,9 +194,9 @@ TEST_F(Idmap2BinaryTests, Lookup) { "--resid", StringPrintf("0x%08x", R::target::string::str1)}); // clang-format on ASSERT_THAT(result, NotNull()); - ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; - ASSERT_NE(result->stdout.find("overlay-1"), std::string::npos); - ASSERT_EQ(result->stdout.find("overlay-1-sv"), std::string::npos); + ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; + ASSERT_NE(result->stdout_str.find("overlay-1"), std::string::npos); + ASSERT_EQ(result->stdout_str.find("overlay-1-sv"), std::string::npos); // clang-format off result = ExecuteBinary({"idmap2", @@ -206,9 +206,9 @@ TEST_F(Idmap2BinaryTests, Lookup) { "--resid", "test.target:string/str1"}); // clang-format on ASSERT_THAT(result, NotNull()); - ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; - ASSERT_NE(result->stdout.find("overlay-1"), std::string::npos); - ASSERT_EQ(result->stdout.find("overlay-1-sv"), std::string::npos); + ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; + ASSERT_NE(result->stdout_str.find("overlay-1"), std::string::npos); + ASSERT_EQ(result->stdout_str.find("overlay-1-sv"), std::string::npos); // clang-format off result = ExecuteBinary({"idmap2", @@ -218,8 +218,8 @@ TEST_F(Idmap2BinaryTests, Lookup) { "--resid", "test.target:string/str1"}); // clang-format on ASSERT_THAT(result, NotNull()); - ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; - ASSERT_NE(result->stdout.find("overlay-1-sv"), std::string::npos); + ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; + ASSERT_NE(result->stdout_str.find("overlay-1-sv"), std::string::npos); unlink(GetIdmapPath().c_str()); } diff --git a/cmds/idmap2/tests/IdmapTests.cpp b/cmds/idmap2/tests/IdmapTests.cpp index 9c6402a6e36e..738b9cf237c9 100644 --- a/cmds/idmap2/tests/IdmapTests.cpp +++ b/cmds/idmap2/tests/IdmapTests.cpp @@ -37,7 +37,6 @@ #include "idmap2/Idmap.h" #include "idmap2/LogInfo.h" -using android::Res_value; using ::testing::NotNull; using PolicyFlags = android::ResTable_overlayable_policy_header::PolicyFlags; diff --git a/cmds/idmap2/tests/ResourceMappingTests.cpp b/cmds/idmap2/tests/ResourceMappingTests.cpp index 5a1d808af06f..32b3d1326d92 100644 --- a/cmds/idmap2/tests/ResourceMappingTests.cpp +++ b/cmds/idmap2/tests/ResourceMappingTests.cpp @@ -29,8 +29,6 @@ #include "idmap2/LogInfo.h" #include "idmap2/ResourceMapping.h" -using android::Res_value; - using PolicyFlags = android::ResTable_overlayable_policy_header::PolicyFlags; namespace android::idmap2 { diff --git a/cmds/incidentd/src/WorkDirectory.cpp b/cmds/incidentd/src/WorkDirectory.cpp index 23d80d7953b7..0d8bd40a4de1 100644 --- a/cmds/incidentd/src/WorkDirectory.cpp +++ b/cmds/incidentd/src/WorkDirectory.cpp @@ -280,7 +280,7 @@ void ReportFile::addReport(const IncidentReportArgs& args) { // Lower privacy policy (less restrictive) wins. report->set_privacy_policy(args.getPrivacyPolicy()); } - report->set_all_sections(report->all_sections() | args.all()); + report->set_all_sections(report->all_sections() || args.all()); for (int section: args.sections()) { if (!has_section(*report, section)) { report->add_section(section); diff --git a/cmds/svc/src/com/android/commands/svc/BluetoothCommand.java b/cmds/svc/src/com/android/commands/svc/BluetoothCommand.java deleted file mode 100644 index b572ce24390c..000000000000 --- a/cmds/svc/src/com/android/commands/svc/BluetoothCommand.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 com.android.commands.svc; - -import android.bluetooth.BluetoothAdapter; -import android.os.RemoteException; - -public class BluetoothCommand extends Svc.Command { - - public BluetoothCommand() { - super("bluetooth"); - } - - @Override - public String shortHelp() { - return "Control Bluetooth service"; - } - - @Override - public String longHelp() { - return shortHelp() + "\n" - + "\n" - + "usage: svc bluetooth [enable|disable]\n" - + " Turn Bluetooth on or off.\n\n"; - } - - @Override - public void run(String[] args) { - BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); - - if (adapter == null) { - System.err.println("Got a null BluetoothAdapter, is the system running?"); - return; - } - - if (args.length == 2 && "enable".equals(args[1])) { - adapter.enable(); - } else if (args.length == 2 && "disable".equals(args[1])) { - adapter.disable(); - } else { - System.err.println(longHelp()); - } - } -} diff --git a/cmds/svc/src/com/android/commands/svc/Svc.java b/cmds/svc/src/com/android/commands/svc/Svc.java index 2ed2678bc877..bbad984746a1 100644 --- a/cmds/svc/src/com/android/commands/svc/Svc.java +++ b/cmds/svc/src/com/android/commands/svc/Svc.java @@ -96,7 +96,7 @@ public class Svc { // `svc wifi` has been migrated to WifiShellCommand new UsbCommand(), new NfcCommand(), - new BluetoothCommand(), + // `svc bluetooth` has been migrated to BluetoothShellCommand new SystemServerCommand(), }; } diff --git a/cmds/svc/svc b/cmds/svc/svc index 95265e817c1b..a2c9de32b3d0 100755 --- a/cmds/svc/svc +++ b/cmds/svc/svc @@ -33,6 +33,25 @@ if [ "x$1" == "xdata" ]; then exit 1 fi +# `svc bluetooth` has been migrated to BluetoothShellCommand, +# simply perform translation to `cmd bluetooth set-bluetooth-enabled` here. +if [ "x$1" == "xbluetooth" ]; then + # `cmd wifi` by convention uses enabled/disabled + # instead of enable/disable + if [ "x$2" == "xenable" ]; then + exec cmd bluetooth_manager enable + elif [ "x$2" == "xdisable" ]; then + exec cmd bluetooth_manager disable + else + echo "Control the Bluetooth manager" + echo "" + echo "usage: svc bluetooth [enable|disable]" + echo " Turn Bluetooth on or off." + echo "" + fi + exit 1 +fi + export CLASSPATH=/system/framework/svc.jar exec app_process /system/bin com.android.commands.svc.Svc "$@" |