summaryrefslogtreecommitdiff
path: root/cmds
diff options
context:
space:
mode:
Diffstat (limited to 'cmds')
-rw-r--r--cmds/dumpstate/README.md6
-rw-r--r--cmds/dumpstate/dumpstate.cpp14
-rw-r--r--cmds/dumpstate/dumpstate.h5
-rw-r--r--cmds/installd/binder/android/os/IInstalld.aidl2
-rw-r--r--cmds/installd/dexopt.h16
-rw-r--r--cmds/installd/otapreopt_chroot.cpp8
-rw-r--r--cmds/surfacereplayer/proto/src/trace.proto22
-rw-r--r--cmds/surfacereplayer/replayer/Event.cpp1
-rw-r--r--cmds/surfacereplayer/replayer/Event.h2
-rw-r--r--cmds/surfacereplayer/replayer/Replayer.cpp44
-rw-r--r--cmds/surfacereplayer/replayer/Replayer.h10
11 files changed, 113 insertions, 17 deletions
diff --git a/cmds/dumpstate/README.md b/cmds/dumpstate/README.md
index c818c05117..26dabbbcef 100644
--- a/cmds/dumpstate/README.md
+++ b/cmds/dumpstate/README.md
@@ -92,6 +92,12 @@ Then to restore the default version:
adb shell setprop dumpstate.version default
```
+## To set Bugreport API workflow for bugreport
+
+```
+adb shell setprop settings_call_bugreport_api true
+```
+
## Code style and formatting
Use the style defined at the
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index c98784e681..a8e6738228 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -2022,12 +2022,12 @@ static void PrepareToWriteToFile() {
}
if (ds.options_->do_fb) {
- ds.screenshot_path_ = ds.GetPath(".png");
+ ds.screenshot_path_ = ds.GetPath(ds.CalledByApi() ? "-tmp.png" : ".png");
}
ds.tmp_path_ = ds.GetPath(".tmp");
ds.log_path_ = ds.GetPath("-dumpstate_log-" + std::to_string(ds.pid_) + ".txt");
- std::string destination = ds.options_->bugreport_fd.get() != -1
+ std::string destination = ds.CalledByApi()
? StringPrintf("[fd:%d]", ds.options_->bugreport_fd.get())
: ds.bugreport_internal_dir_.c_str();
MYLOGD(
@@ -2041,7 +2041,7 @@ static void PrepareToWriteToFile() {
ds.tmp_path_.c_str(), ds.screenshot_path_.c_str());
if (ds.options_->do_zip_file) {
- ds.path_ = ds.GetPath(".zip");
+ ds.path_ = ds.GetPath(ds.CalledByApi() ? "-tmp.zip" : ".zip");
MYLOGD("Creating initial .zip file (%s)\n", ds.path_.c_str());
create_parent_dirs(ds.path_.c_str());
ds.zip_file.reset(fopen(ds.path_.c_str(), "wb"));
@@ -2076,7 +2076,7 @@ static void FinalizeFile() {
MYLOGI("changing suffix from %s to %s\n", ds.name_.c_str(), name.c_str());
ds.name_ = name;
if (!ds.screenshot_path_.empty()) {
- std::string new_screenshot_path = ds.GetPath(".png");
+ std::string new_screenshot_path = ds.GetPath(ds.CalledByApi() ? "-tmp.png" : ".png");
if (rename(ds.screenshot_path_.c_str(), new_screenshot_path.c_str())) {
MYLOGE("rename(%s, %s): %s\n", ds.screenshot_path_.c_str(),
new_screenshot_path.c_str(), strerror(errno));
@@ -2094,7 +2094,7 @@ static void FinalizeFile() {
} else {
do_text_file = false;
// If the user has changed the suffix, we need to change the zip file name.
- std::string new_path = ds.GetPath(".zip");
+ std::string new_path = ds.GetPath(ds.CalledByApi() ? "-tmp.zip" : ".zip");
if (ds.path_ != new_path) {
MYLOGD("Renaming zip file from %s to %s\n", ds.path_.c_str(), new_path.c_str());
if (rename(ds.path_.c_str(), new_path.c_str())) {
@@ -2749,6 +2749,10 @@ bool Dumpstate::IsUserConsentDenied() const {
ds.consent_callback_->getResult() == UserConsentResult::DENIED;
}
+bool Dumpstate::CalledByApi() const {
+ return ds.options_->bugreport_fd.get() != -1 ? true : false;
+}
+
void Dumpstate::CleanupFiles() {
android::os::UnlinkAndLogOnError(tmp_path_);
android::os::UnlinkAndLogOnError(screenshot_path_);
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index 82bf8219a2..5ba84cad84 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -344,6 +344,11 @@ class Dumpstate {
bool IsUserConsentDenied() const;
/*
+ * Returns true if dumpstate is called by bugreporting API
+ */
+ bool CalledByApi() const;
+
+ /*
* Structure to hold options that determine the behavior of dumpstate.
*/
struct DumpOptions {
diff --git a/cmds/installd/binder/android/os/IInstalld.aidl b/cmds/installd/binder/android/os/IInstalld.aidl
index 26e9984f11..d99bcc8d13 100644
--- a/cmds/installd/binder/android/os/IInstalld.aidl
+++ b/cmds/installd/binder/android/os/IInstalld.aidl
@@ -127,4 +127,6 @@ interface IInstalld {
const int FLAG_USE_QUOTA = 0x1000;
const int FLAG_FORCE = 0x2000;
+
+ const int FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES = 0x20000;
}
diff --git a/cmds/installd/dexopt.h b/cmds/installd/dexopt.h
index a8c48c564e..ef739bafd4 100644
--- a/cmds/installd/dexopt.h
+++ b/cmds/installd/dexopt.h
@@ -32,15 +32,15 @@ static constexpr int DEX2OAT_FROM_SCRATCH = 1;
static constexpr int DEX2OAT_FOR_BOOT_IMAGE = 2;
static constexpr int DEX2OAT_FOR_FILTER = 3;
-#define ANDROID_RUNTIME_APEX_BIN "/apex/com.android.runtime/bin"
+#define ANDROID_ART_APEX_BIN "/apex/com.android.art/bin"
// Location of binaries in the Android Runtime APEX.
-static constexpr const char* kDex2oatPath = ANDROID_RUNTIME_APEX_BIN "/dex2oat";
-static constexpr const char* kDex2oatDebugPath = ANDROID_RUNTIME_APEX_BIN "/dex2oatd";
-static constexpr const char* kProfmanPath = ANDROID_RUNTIME_APEX_BIN "/profman";
-static constexpr const char* kProfmanDebugPath = ANDROID_RUNTIME_APEX_BIN "/profmand";
-static constexpr const char* kDexoptanalyzerPath = ANDROID_RUNTIME_APEX_BIN "/dexoptanalyzer";
-static constexpr const char* kDexoptanalyzerDebugPath = ANDROID_RUNTIME_APEX_BIN "/dexoptanalyzerd";
-#undef ANDROID_RUNTIME_APEX_BIN
+static constexpr const char* kDex2oatPath = ANDROID_ART_APEX_BIN "/dex2oat";
+static constexpr const char* kDex2oatDebugPath = ANDROID_ART_APEX_BIN "/dex2oatd";
+static constexpr const char* kProfmanPath = ANDROID_ART_APEX_BIN "/profman";
+static constexpr const char* kProfmanDebugPath = ANDROID_ART_APEX_BIN "/profmand";
+static constexpr const char* kDexoptanalyzerPath = ANDROID_ART_APEX_BIN "/dexoptanalyzer";
+static constexpr const char* kDexoptanalyzerDebugPath = ANDROID_ART_APEX_BIN "/dexoptanalyzerd";
+#undef ANDROID_ART_APEX_BIN
// Clear the reference profile identified by the given profile name.
bool clear_primary_reference_profile(const std::string& pkgname, const std::string& profile_name);
diff --git a/cmds/installd/otapreopt_chroot.cpp b/cmds/installd/otapreopt_chroot.cpp
index b4bcd53120..3ff9d11806 100644
--- a/cmds/installd/otapreopt_chroot.cpp
+++ b/cmds/installd/otapreopt_chroot.cpp
@@ -233,17 +233,17 @@ static int otapreopt_chroot(const int argc, char **arg) {
}
// Try to mount APEX packages in "/apex" in the chroot dir. We need at least
- // the Android Runtime APEX, as it is required by otapreopt to run dex2oat.
+ // the ART APEX, as it is required by otapreopt to run dex2oat.
std::vector<apex::ApexFile> active_packages = ActivateApexPackages();
- // Check that an Android Runtime APEX has been activated; clean up and exit
+ // Check that an ART APEX has been activated; clean up and exit
// early otherwise.
if (std::none_of(active_packages.begin(),
active_packages.end(),
[](const apex::ApexFile& package){
- return package.GetManifest().name() == "com.android.runtime";
+ return package.GetManifest().name() == "com.android.art";
})) {
- LOG(FATAL_WITHOUT_ABORT) << "No activated com.android.runtime APEX package.";
+ LOG(FATAL_WITHOUT_ABORT) << "No activated com.android.art APEX package.";
DeactivateApexPackages(active_packages);
exit(217);
}
diff --git a/cmds/surfacereplayer/proto/src/trace.proto b/cmds/surfacereplayer/proto/src/trace.proto
index c70bc3e5c1..792ff91dfa 100644
--- a/cmds/surfacereplayer/proto/src/trace.proto
+++ b/cmds/surfacereplayer/proto/src/trace.proto
@@ -1,5 +1,6 @@
syntax = "proto2";
option optimize_for = LITE_RUNTIME;
+package android.surfaceflinger;
message Trace {
repeated Increment increment = 1;
@@ -46,6 +47,10 @@ message SurfaceChange {
SecureFlagChange secure_flag = 14;
DeferredTransactionChange deferred_transaction = 15;
CornerRadiusChange corner_radius = 16;
+ ReparentChange reparent = 17;
+ RelativeParentChange relative_parent = 18;
+ DetachChildrenChange detach_children = 19;
+ ReparentChildrenChange reparent_children = 20;
}
}
@@ -177,3 +182,20 @@ message PowerModeUpdate {
required int32 id = 1;
required int32 mode = 2;
}
+
+message ReparentChange {
+ required int32 parent_id = 1;
+}
+
+message ReparentChildrenChange {
+ required int32 parent_id = 1;
+}
+
+message RelativeParentChange {
+ required int32 relative_parent_id = 1;
+ required int32 z = 2;
+}
+
+message DetachChildrenChange {
+ required bool detach_children = 1;
+}
diff --git a/cmds/surfacereplayer/replayer/Event.cpp b/cmds/surfacereplayer/replayer/Event.cpp
index 390d3982ca..64db5f07b1 100644
--- a/cmds/surfacereplayer/replayer/Event.cpp
+++ b/cmds/surfacereplayer/replayer/Event.cpp
@@ -17,6 +17,7 @@
#include "Event.h"
using namespace android;
+using Increment = surfaceflinger::Increment;
Event::Event(Increment::IncrementCase type) : mIncrementType(type) {}
diff --git a/cmds/surfacereplayer/replayer/Event.h b/cmds/surfacereplayer/replayer/Event.h
index 44b60f566a..09a7c248d5 100644
--- a/cmds/surfacereplayer/replayer/Event.h
+++ b/cmds/surfacereplayer/replayer/Event.h
@@ -24,6 +24,8 @@
namespace android {
+using Increment = surfaceflinger::Increment;
+
class Event {
public:
Event(Increment::IncrementCase);
diff --git a/cmds/surfacereplayer/replayer/Replayer.cpp b/cmds/surfacereplayer/replayer/Replayer.cpp
index 34886a99e9..a4a9b6a6f4 100644
--- a/cmds/surfacereplayer/replayer/Replayer.cpp
+++ b/cmds/surfacereplayer/replayer/Replayer.cpp
@@ -412,6 +412,18 @@ status_t Replayer::doSurfaceTransaction(
setDeferredTransaction(transaction, change.id(),
change.deferred_transaction());
break;
+ case SurfaceChange::SurfaceChangeCase::kReparent:
+ setReparentChange(transaction, change.id(), change.reparent());
+ break;
+ case SurfaceChange::SurfaceChangeCase::kReparentChildren:
+ setReparentChildrenChange(transaction, change.id(), change.reparent_children());
+ break;
+ case SurfaceChange::SurfaceChangeCase::kRelativeParent:
+ setRelativeParentChange(transaction, change.id(), change.relative_parent());
+ break;
+ case SurfaceChange::SurfaceChangeCase::kDetachChildren:
+ setDetachChildrenChange(transaction, change.id(), change.detach_children());
+ break;
default:
status = 1;
break;
@@ -680,3 +692,35 @@ status_t Replayer::loadSurfaceComposerClient() {
mComposerClient = new SurfaceComposerClient;
return mComposerClient->initCheck();
}
+
+void Replayer::setReparentChange(SurfaceComposerClient::Transaction& t,
+ layer_id id, const ReparentChange& c) {
+ sp<IBinder> newParentHandle = nullptr;
+ if (mLayers.count(c.parent_id()) != 0 && mLayers[c.parent_id()] != nullptr) {
+ newParentHandle = mLayers[c.parent_id()]->getHandle();
+ }
+ t.reparent(mLayers[id], newParentHandle);
+}
+
+void Replayer::setRelativeParentChange(SurfaceComposerClient::Transaction& t,
+ layer_id id, const RelativeParentChange& c) {
+ if (mLayers.count(c.relative_parent_id()) == 0 || mLayers[c.relative_parent_id()] == nullptr) {
+ ALOGE("Layer %d not found in set relative parent transaction", c.relative_parent_id());
+ return;
+ }
+ t.setRelativeLayer(mLayers[id], mLayers[c.relative_parent_id()]->getHandle(), c.z());
+}
+
+void Replayer::setDetachChildrenChange(SurfaceComposerClient::Transaction& t,
+ layer_id id, const DetachChildrenChange& c) {
+ t.detachChildren(mLayers[id]);
+}
+
+void Replayer::setReparentChildrenChange(SurfaceComposerClient::Transaction& t,
+ layer_id id, const ReparentChildrenChange& c) {
+ if (mLayers.count(c.parent_id()) == 0 || mLayers[c.parent_id()] == nullptr) {
+ ALOGE("Layer %d not found in reparent children transaction", c.parent_id());
+ return;
+ }
+ t.reparentChildren(mLayers[id], mLayers[c.parent_id()]->getHandle());
+}
diff --git a/cmds/surfacereplayer/replayer/Replayer.h b/cmds/surfacereplayer/replayer/Replayer.h
index ad807ee950..3b94618acb 100644
--- a/cmds/surfacereplayer/replayer/Replayer.h
+++ b/cmds/surfacereplayer/replayer/Replayer.h
@@ -38,6 +38,8 @@
#include <unordered_map>
#include <utility>
+using namespace android::surfaceflinger;
+
namespace android {
const auto DEFAULT_PATH = "/data/local/tmp/SurfaceTrace.dat";
@@ -108,6 +110,14 @@ class Replayer {
layer_id id, const SecureFlagChange& sfc);
void setDeferredTransaction(SurfaceComposerClient::Transaction& t,
layer_id id, const DeferredTransactionChange& dtc);
+ void setReparentChange(SurfaceComposerClient::Transaction& t,
+ layer_id id, const ReparentChange& c);
+ void setRelativeParentChange(SurfaceComposerClient::Transaction& t,
+ layer_id id, const RelativeParentChange& c);
+ void setDetachChildrenChange(SurfaceComposerClient::Transaction& t,
+ layer_id id, const DetachChildrenChange& c);
+ void setReparentChildrenChange(SurfaceComposerClient::Transaction& t,
+ layer_id id, const ReparentChildrenChange& c);
void setDisplaySurface(SurfaceComposerClient::Transaction& t,
display_id id, const DispSurfaceChange& dsc);