summaryrefslogtreecommitdiff
path: root/cmds
diff options
context:
space:
mode:
Diffstat (limited to 'cmds')
-rw-r--r--cmds/bootanimation/BootAnimation.cpp46
-rw-r--r--cmds/bootanimation/BootAnimation.h2
-rw-r--r--cmds/bootanimation/FORMAT.md35
-rw-r--r--cmds/incidentd/src/IncidentService.cpp2
-rw-r--r--cmds/incidentd/src/WorkDirectory.cpp2
-rw-r--r--cmds/screencap/screencap.cpp16
-rw-r--r--cmds/sm/src/com/android/commands/sm/Sm.java3
-rw-r--r--cmds/telecom/src/com/android/commands/telecom/Telecom.java13
8 files changed, 87 insertions, 32 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index 30a8a8e72437..1f4a64f5c7f1 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -81,18 +81,18 @@ static constexpr const char* PRODUCT_USERSPACE_REBOOT_ANIMATION_FILE = "/product
static constexpr const char* OEM_USERSPACE_REBOOT_ANIMATION_FILE = "/oem/media/userspace-reboot.zip";
static constexpr const char* SYSTEM_USERSPACE_REBOOT_ANIMATION_FILE = "/system/media/userspace-reboot.zip";
-static const char SYSTEM_DATA_DIR_PATH[] = "/data/system";
-static const char SYSTEM_TIME_DIR_NAME[] = "time";
-static const char SYSTEM_TIME_DIR_PATH[] = "/data/system/time";
+static const char BOOTANIM_DATA_DIR_PATH[] = "/data/bootanim";
+static const char BOOTANIM_TIME_DIR_NAME[] = "time";
+static const char BOOTANIM_TIME_DIR_PATH[] = "/data/bootanim/time";
static const char CLOCK_FONT_ASSET[] = "images/clock_font.png";
static const char CLOCK_FONT_ZIP_NAME[] = "clock_font.png";
static const char PROGRESS_FONT_ASSET[] = "images/progress_font.png";
static const char PROGRESS_FONT_ZIP_NAME[] = "progress_font.png";
static const char LAST_TIME_CHANGED_FILE_NAME[] = "last_time_change";
-static const char LAST_TIME_CHANGED_FILE_PATH[] = "/data/system/time/last_time_change";
+static const char LAST_TIME_CHANGED_FILE_PATH[] = "/data/bootanim/time/last_time_change";
static const char ACCURATE_TIME_FLAG_FILE_NAME[] = "time_is_accurate";
-static const char ACCURATE_TIME_FLAG_FILE_PATH[] = "/data/system/time/time_is_accurate";
-static const char TIME_FORMAT_12_HOUR_FLAG_FILE_PATH[] = "/data/system/time/time_format_12_hour";
+static const char ACCURATE_TIME_FLAG_FILE_PATH[] = "/data/bootanim/time/time_is_accurate";
+static const char TIME_FORMAT_12_HOUR_FLAG_FILE_PATH[] = "/data/bootanim/time/time_format_12_hour";
// Java timestamp format. Don't show the clock if the date is before 2000-01-01 00:00:00.
static const long long ACCURATE_TIME_EPOCH = 946684800000;
static constexpr char FONT_BEGIN_CHAR = ' ';
@@ -105,6 +105,7 @@ static const int TEXT_MISSING_VALUE = INT_MIN;
static const char EXIT_PROP_NAME[] = "service.bootanim.exit";
static const char PROGRESS_PROP_NAME[] = "service.bootanim.progress";
static const char DISPLAYS_PROP_NAME[] = "persist.service.bootanim.displays";
+static const char CLOCK_ENABLED_PROP_NAME[] = "persist.sys.bootanim.clock.enabled";
static const int ANIM_ENTRY_NAME_MAX = ANIM_PATH_MAX + 1;
static constexpr size_t TEXT_POS_LEN_MAX = 16;
static const int DYNAMIC_COLOR_COUNT = 4;
@@ -542,16 +543,15 @@ status_t BootAnimation::readyToRun() {
// In the case of multi-display, boot animation shows on the specified displays
// in addition to the primary display
- auto ids = SurfaceComposerClient::getPhysicalDisplayIds();
- constexpr uint32_t LAYER_STACK = 0;
- for (auto id : physicalDisplayIds) {
+ const auto ids = SurfaceComposerClient::getPhysicalDisplayIds();
+ for (const auto id : physicalDisplayIds) {
if (std::find(ids.begin(), ids.end(), id) != ids.end()) {
- sp<IBinder> token = SurfaceComposerClient::getPhysicalDisplayToken(id);
- if (token != nullptr)
- t.setDisplayLayerStack(token, LAYER_STACK);
+ if (const auto token = SurfaceComposerClient::getPhysicalDisplayToken(id)) {
+ t.setDisplayLayerStack(token, ui::DEFAULT_LAYER_STACK);
+ }
}
}
- t.setLayerStack(control, LAYER_STACK);
+ t.setLayerStack(control, ui::DEFAULT_LAYER_STACK);
}
t.setLayer(control, 0x40000000)
@@ -1321,6 +1321,8 @@ bool BootAnimation::movie() {
}
if (!anyPartHasClock) {
mClockEnabled = false;
+ } else if (!android::base::GetBoolProperty(CLOCK_ENABLED_PROP_NAME, false)) {
+ mClockEnabled = false;
}
// Check if npot textures are supported
@@ -1363,7 +1365,7 @@ bool BootAnimation::movie() {
mTimeCheckThread->run("BootAnimation::TimeCheckThread", PRIORITY_NORMAL);
}
- if (mAnimation != nullptr && mAnimation->dynamicColoringEnabled) {
+ if (mAnimation->dynamicColoringEnabled) {
initDynamicColors();
}
@@ -1739,7 +1741,7 @@ bool BootAnimation::updateIsTimeAccurate() {
}
BootAnimation::TimeCheckThread::TimeCheckThread(BootAnimation* bootAnimation) : Thread(false),
- mInotifyFd(-1), mSystemWd(-1), mTimeWd(-1), mBootAnimation(bootAnimation) {}
+ mInotifyFd(-1), mBootAnimWd(-1), mTimeWd(-1), mBootAnimation(bootAnimation) {}
BootAnimation::TimeCheckThread::~TimeCheckThread() {
// mInotifyFd may be -1 but that's ok since we're not at risk of attempting to close a valid FD.
@@ -1782,7 +1784,7 @@ bool BootAnimation::TimeCheckThread::doThreadLoop() {
const struct inotify_event *event;
for (char* ptr = buff; ptr < buff + length; ptr += sizeof(struct inotify_event) + event->len) {
event = (const struct inotify_event *) ptr;
- if (event->wd == mSystemWd && strcmp(SYSTEM_TIME_DIR_NAME, event->name) == 0) {
+ if (event->wd == mBootAnimWd && strcmp(BOOTANIM_TIME_DIR_NAME, event->name) == 0) {
addTimeDirWatch();
} else if (event->wd == mTimeWd && (strcmp(LAST_TIME_CHANGED_FILE_NAME, event->name) == 0
|| strcmp(ACCURATE_TIME_FLAG_FILE_NAME, event->name) == 0)) {
@@ -1794,12 +1796,12 @@ bool BootAnimation::TimeCheckThread::doThreadLoop() {
}
void BootAnimation::TimeCheckThread::addTimeDirWatch() {
- mTimeWd = inotify_add_watch(mInotifyFd, SYSTEM_TIME_DIR_PATH,
+ mTimeWd = inotify_add_watch(mInotifyFd, BOOTANIM_TIME_DIR_PATH,
IN_CLOSE_WRITE | IN_MOVED_TO | IN_ATTRIB);
if (mTimeWd > 0) {
// No need to watch for the time directory to be created if it already exists
- inotify_rm_watch(mInotifyFd, mSystemWd);
- mSystemWd = -1;
+ inotify_rm_watch(mInotifyFd, mBootAnimWd);
+ mBootAnimWd = -1;
}
}
@@ -1810,11 +1812,11 @@ status_t BootAnimation::TimeCheckThread::readyToRun() {
return NO_INIT;
}
- mSystemWd = inotify_add_watch(mInotifyFd, SYSTEM_DATA_DIR_PATH, IN_CREATE | IN_ATTRIB);
- if (mSystemWd < 0) {
+ mBootAnimWd = inotify_add_watch(mInotifyFd, BOOTANIM_DATA_DIR_PATH, IN_CREATE | IN_ATTRIB);
+ if (mBootAnimWd < 0) {
close(mInotifyFd);
mInotifyFd = -1;
- SLOGE("Could not add watch for %s: %s", SYSTEM_DATA_DIR_PATH, strerror(errno));
+ SLOGE("Could not add watch for %s: %s", BOOTANIM_DATA_DIR_PATH, strerror(errno));
return NO_INIT;
}
diff --git a/cmds/bootanimation/BootAnimation.h b/cmds/bootanimation/BootAnimation.h
index 7a597da533ee..4c378cbc48bd 100644
--- a/cmds/bootanimation/BootAnimation.h
+++ b/cmds/bootanimation/BootAnimation.h
@@ -161,7 +161,7 @@ private:
void addTimeDirWatch();
int mInotifyFd;
- int mSystemWd;
+ int mBootAnimWd;
int mTimeWd;
BootAnimation* mBootAnimation;
};
diff --git a/cmds/bootanimation/FORMAT.md b/cmds/bootanimation/FORMAT.md
index 1678053c48d9..64814c8a25e2 100644
--- a/cmds/bootanimation/FORMAT.md
+++ b/cmds/bootanimation/FORMAT.md
@@ -31,6 +31,9 @@ The first line defines the general parameters of the animation:
+ The percentage will be displayed with an x-coordinate of 'c', and a
y-coordinate set to 1/3 of the animation height.
+Next, provide an optional line for dynamic coloring attributes, should dynamic coloring be used.
+See the dyanmic coloring section for format details. Skip if you don't use dynamic coloring.
+
It is followed by a number of rows of the form:
TYPE COUNT PAUSE PATH [FADE [#RGBHEX [CLOCK1 [CLOCK2]]]]
@@ -140,3 +143,35 @@ Some animations benefit from being reduced to 256 colors:
Note that the ZIP archive is not actually compressed! The PNG files are already as compressed
as they can reasonably get, and there is unlikely to be any redundancy between files.
+
+### Dynamic coloring
+
+Dynamic coloring is a render mode that draws the boot animation using a color transition.
+In this mode, instead of directly rendering the PNG images, it treats the R, G, B, A channels
+of input images as area masks of dynamic colors, which interpolates between start and end colors
+based on animation progression.
+
+To enable it, add the following line as the second line of desc.txt:
+
+ dynamic_colors PATH #RGBHEX0 #RGBHEX1 #RGBHEX2 #RGBHEX3
+
+ * **PATH:** file path of the part to apply dynamic color transition to.
+ Any part before this part will be rendered in the start colors.
+ Any part after will be rendered in the end colors.
+ * **RGBHEX1:** the first start color (masked by the R channel), specified as `#RRGGBB`.
+ * **RGBHEX2:** the second start color (masked by the G channel), specified as `#RRGGBB`.
+ * **RGBHEX3:** the thrid start color (masked by the B channel), specified as `#RRGGBB`.
+ * **RGBHEX4:** the forth start color (masked by the A channel), specified as `#RRGGBB`.
+
+The end colors will be read from the following system properties:
+
+ * persist.bootanim.color1
+ * persist.bootanim.color2
+ * persist.bootanim.color3
+ * persist.bootanim.color4
+
+When missing, the end colors will default to the start colors, effectively producing no color
+transition.
+
+Prepare your PNG images so that the R, G, B, A channels indicates the areas to draw color1,
+color2, color3 and color4 respectively.
diff --git a/cmds/incidentd/src/IncidentService.cpp b/cmds/incidentd/src/IncidentService.cpp
index 13bf197aa9dc..fbb99d2aea89 100644
--- a/cmds/incidentd/src/IncidentService.cpp
+++ b/cmds/incidentd/src/IncidentService.cpp
@@ -43,7 +43,7 @@ enum {
#define DEFAULT_DELAY_NS (1000000000LL)
-#define DEFAULT_BYTES_SIZE_LIMIT (96 * 1024 * 1024) // 96MB
+#define DEFAULT_BYTES_SIZE_LIMIT (400 * 1024 * 1024) // 400MB
#define DEFAULT_REFACTORY_PERIOD_MS (24 * 60 * 60 * 1000) // 1 Day
// Skip these sections (for dumpstate only)
diff --git a/cmds/incidentd/src/WorkDirectory.cpp b/cmds/incidentd/src/WorkDirectory.cpp
index 23d80d7953b7..dd33fdfc28c3 100644
--- a/cmds/incidentd/src/WorkDirectory.cpp
+++ b/cmds/incidentd/src/WorkDirectory.cpp
@@ -533,7 +533,7 @@ status_t ReportFile::load_envelope_impl(bool cleanup) {
WorkDirectory::WorkDirectory()
:mDirectory("/data/misc/incidents"),
mMaxFileCount(100),
- mMaxDiskUsageBytes(100 * 1024 * 1024) { // Incident reports can take up to 100MB on disk.
+ mMaxDiskUsageBytes(400 * 1024 * 1024) { // Incident reports can take up to 400MB on disk.
// TODO: Should be a flag.
create_directory(mDirectory.c_str());
}
diff --git a/cmds/screencap/screencap.cpp b/cmds/screencap/screencap.cpp
index d4da5e554591..7e6a521ca46c 100644
--- a/cmds/screencap/screencap.cpp
+++ b/cmds/screencap/screencap.cpp
@@ -45,13 +45,13 @@ using namespace android;
#define COLORSPACE_SRGB 1
#define COLORSPACE_DISPLAY_P3 2
-static void usage(const char* pname, PhysicalDisplayId displayId)
+static void usage(const char* pname, DisplayId displayId)
{
fprintf(stderr,
"usage: %s [-hp] [-d display-id] [FILENAME]\n"
" -h: this message\n"
" -p: save the file as a png.\n"
- " -d: specify the physical display ID to capture (default: %s)\n"
+ " -d: specify the display ID to capture (default: %s)\n"
" see \"dumpsys SurfaceFlinger --display-id\" for valid display IDs.\n"
"If FILENAME ends with .png it will be saved as a png.\n"
"If FILENAME is not given, the results will be printed to stdout.\n",
@@ -121,9 +121,9 @@ static status_t notifyMediaScanner(const char* fileName) {
int main(int argc, char** argv)
{
- std::optional<PhysicalDisplayId> displayId = SurfaceComposerClient::getInternalDisplayId();
+ std::optional<DisplayId> displayId = SurfaceComposerClient::getInternalDisplayId();
if (!displayId) {
- fprintf(stderr, "Failed to get token for internal display\n");
+ fprintf(stderr, "Failed to get ID for internal display\n");
return 1;
}
@@ -136,7 +136,11 @@ int main(int argc, char** argv)
png = true;
break;
case 'd':
- displayId = PhysicalDisplayId(atoll(optarg));
+ displayId = DisplayId::fromValue(atoll(optarg));
+ if (!displayId) {
+ fprintf(stderr, "Invalid display ID\n");
+ return 1;
+ }
break;
case '?':
case 'h':
@@ -182,7 +186,7 @@ int main(int argc, char** argv)
ProcessState::self()->startThreadPool();
sp<SyncScreenCaptureListener> captureListener = new SyncScreenCaptureListener();
- status_t result = ScreenshotClient::captureDisplay(displayId->value, captureListener);
+ status_t result = ScreenshotClient::captureDisplay(*displayId, captureListener);
if (result != NO_ERROR) {
close(fd);
return 1;
diff --git a/cmds/sm/src/com/android/commands/sm/Sm.java b/cmds/sm/src/com/android/commands/sm/Sm.java
index 260c8a47ea3c..b384e702ac4e 100644
--- a/cmds/sm/src/com/android/commands/sm/Sm.java
+++ b/cmds/sm/src/com/android/commands/sm/Sm.java
@@ -259,7 +259,8 @@ public final class Sm {
public void runDisableAppDataIsolation() throws RemoteException {
if (!SystemProperties.getBoolean(
ANDROID_VOLD_APP_DATA_ISOLATION_ENABLED_PROPERTY, false)) {
- throw new IllegalStateException("Storage app data isolation is not enabled.");
+ System.err.println("Storage app data isolation is not enabled.");
+ return;
}
final String pkgName = nextArg();
final int pid = Integer.parseInt(nextArg());
diff --git a/cmds/telecom/src/com/android/commands/telecom/Telecom.java b/cmds/telecom/src/com/android/commands/telecom/Telecom.java
index 9c044b5e632e..52f883b5fbb7 100644
--- a/cmds/telecom/src/com/android/commands/telecom/Telecom.java
+++ b/cmds/telecom/src/com/android/commands/telecom/Telecom.java
@@ -71,6 +71,8 @@ public final class Telecom extends BaseCommand {
private static final String COMMAND_GET_DEFAULT_DIALER = "get-default-dialer";
private static final String COMMAND_STOP_BLOCK_SUPPRESSION = "stop-block-suppression";
private static final String COMMAND_CLEANUP_STUCK_CALLS = "cleanup-stuck-calls";
+ private static final String COMMAND_CLEANUP_ORPHAN_PHONE_ACCOUNTS =
+ "cleanup-orphan-phone-accounts";
private static final String COMMAND_RESET_CAR_MODE = "reset-car-mode";
/**
@@ -125,6 +127,9 @@ public final class Telecom extends BaseCommand {
+ " provider after a call to emergency services.\n"
+ "usage: telecom cleanup-stuck-calls: Clear any disconnected calls that have"
+ " gotten wedged in Telecom.\n"
+ + "usage: telecom cleanup-orphan-phone-accounts: remove any phone accounts that"
+ + " no longer have a valid UserHandle or accounts that no longer belongs to an"
+ + " installed package.\n"
+ "usage: telecom set-emer-phone-account-filter <PACKAGE>\n"
+ "\n"
+ "telecom set-phone-account-enabled: Enables the given phone account, if it has"
@@ -227,6 +232,9 @@ public final class Telecom extends BaseCommand {
case COMMAND_CLEANUP_STUCK_CALLS:
runCleanupStuckCalls();
break;
+ case COMMAND_CLEANUP_ORPHAN_PHONE_ACCOUNTS:
+ runCleanupOrphanPhoneAccounts();
+ break;
case COMMAND_RESET_CAR_MODE:
runResetCarMode();
break;
@@ -362,6 +370,11 @@ public final class Telecom extends BaseCommand {
mTelecomService.cleanupStuckCalls();
}
+ private void runCleanupOrphanPhoneAccounts() throws RemoteException {
+ System.out.println("Success - cleaned up " + mTelecomService.cleanupOrphanPhoneAccounts()
+ + " phone accounts.");
+ }
+
private void runResetCarMode() throws RemoteException {
mTelecomService.resetCarMode();
}