summaryrefslogtreecommitdiff
path: root/cmds
diff options
context:
space:
mode:
Diffstat (limited to 'cmds')
-rw-r--r--cmds/bootanimation/BootAnimation.cpp15
-rw-r--r--cmds/bootanimation/BootAnimation.h3
-rw-r--r--cmds/bootanimation/BootAnimationUtil.cpp9
-rw-r--r--cmds/dpm/Android.bp5
-rwxr-xr-xcmds/dpm/dpm4
-rw-r--r--cmds/dpm/src/com/android/commands/dpm/Dpm.java275
-rw-r--r--cmds/idmap2/idmap2d/aidl/services/android/os/OverlayablePolicy.aidl22
-rw-r--r--cmds/locksettings/TEST_MAPPING2
-rw-r--r--cmds/sm/src/com/android/commands/sm/Sm.java2
-rw-r--r--cmds/uiautomator/library/Android.bp2
10 files changed, 39 insertions, 300 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index be82b2230183..3109c5c1e075 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -1210,9 +1210,12 @@ bool BootAnimation::movie() {
return false;
}
-bool BootAnimation::shouldStopPlayingPart(const Animation::Part& part, const int fadedFramesCount) {
+bool BootAnimation::shouldStopPlayingPart(const Animation::Part& part,
+ const int fadedFramesCount,
+ const int lastDisplayedProgress) {
// stop playing only if it is time to exit and it's a partial part which has been faded out
- return exitPending() && !part.playUntilComplete && fadedFramesCount >= part.framesToFadeCount;
+ return exitPending() && !part.playUntilComplete && fadedFramesCount >= part.framesToFadeCount &&
+ (lastDisplayedProgress == 0 || lastDisplayedProgress == 100);
}
bool BootAnimation::playAnimation(const Animation& animation) {
@@ -1239,7 +1242,7 @@ bool BootAnimation::playAnimation(const Animation& animation) {
// process the part not only while the count allows but also if already fading
for (int r=0 ; !part.count || r<part.count || fadedFramesCount > 0 ; r++) {
- if (shouldStopPlayingPart(part, fadedFramesCount)) break;
+ if (shouldStopPlayingPart(part, fadedFramesCount, lastDisplayedProgress)) break;
mCallbacks->playPart(i, part, r);
@@ -1256,7 +1259,7 @@ bool BootAnimation::playAnimation(const Animation& animation) {
(i == (pcount -1)) && currentProgress != 0;
for (size_t j=0 ; j<fcount ; j++) {
- if (shouldStopPlayingPart(part, fadedFramesCount)) break;
+ if (shouldStopPlayingPart(part, fadedFramesCount, lastDisplayedProgress)) break;
processDisplayEvents();
@@ -1355,6 +1358,10 @@ bool BootAnimation::playAnimation(const Animation& animation) {
if (exitPending() && !part.count && mCurrentInset >= mTargetInset &&
!part.hasFadingPhase()) {
+ if (lastDisplayedProgress != 0 && lastDisplayedProgress != 100) {
+ android::base::SetProperty(PROGRESS_PROP_NAME, "100");
+ continue;
+ }
break; // exit the infinite non-fading part when it has been played at least once
}
}
diff --git a/cmds/bootanimation/BootAnimation.h b/cmds/bootanimation/BootAnimation.h
index 07432a2168b1..f8a31c6d8790 100644
--- a/cmds/bootanimation/BootAnimation.h
+++ b/cmds/bootanimation/BootAnimation.h
@@ -187,7 +187,8 @@ private:
void resizeSurface(int newWidth, int newHeight);
void projectSceneToWindow();
- bool shouldStopPlayingPart(const Animation::Part& part, int fadedFramesCount);
+ bool shouldStopPlayingPart(const Animation::Part& part, int fadedFramesCount,
+ int lastDisplayedProgress);
void checkExit();
void handleViewport(nsecs_t timestep);
diff --git a/cmds/bootanimation/BootAnimationUtil.cpp b/cmds/bootanimation/BootAnimationUtil.cpp
index 1e417e938359..4f56e5a88c4c 100644
--- a/cmds/bootanimation/BootAnimationUtil.cpp
+++ b/cmds/bootanimation/BootAnimationUtil.cpp
@@ -49,7 +49,14 @@ bool bootAnimationDisabled() {
}
property_get("ro.boot.quiescent", value, "0");
- return atoi(value) > 0;
+ if (atoi(value) > 0) {
+ // Only show the bootanimation for quiescent boots if this system property is set to enabled
+ if (!property_get_bool("ro.bootanim.quiescent.enabled", false)) {
+ return true;
+ }
+ }
+
+ return false;
}
void waitForSurfaceFlinger() {
diff --git a/cmds/dpm/Android.bp b/cmds/dpm/Android.bp
index 665abcd7314d..6819d0982d2c 100644
--- a/cmds/dpm/Android.bp
+++ b/cmds/dpm/Android.bp
@@ -18,8 +18,7 @@ license {
],
}
-java_binary {
+sh_binary {
name: "dpm",
- wrapper: "dpm",
- srcs: ["**/*.java"],
+ src: "dpm",
}
diff --git a/cmds/dpm/dpm b/cmds/dpm/dpm
index e0efdc15a706..784db5b352a9 100755
--- a/cmds/dpm/dpm
+++ b/cmds/dpm/dpm
@@ -1,7 +1,5 @@
#!/system/bin/sh
# Script to start "dpm" on the device
#
-base=/system
-export CLASSPATH=$base/framework/dpm.jar
-exec app_process $base/bin com.android.commands.dpm.Dpm "$@"
+cmd device_policy "$@"
diff --git a/cmds/dpm/src/com/android/commands/dpm/Dpm.java b/cmds/dpm/src/com/android/commands/dpm/Dpm.java
deleted file mode 100644
index d0c2a24d5314..000000000000
--- a/cmds/dpm/src/com/android/commands/dpm/Dpm.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Copyright (C) 2014 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.dpm;
-
-import android.app.ActivityManager;
-import android.app.IActivityManager;
-import android.app.admin.DevicePolicyManager;
-import android.app.admin.IDevicePolicyManager;
-import android.content.ComponentName;
-import android.content.Context;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.os.UserHandle;
-
-import com.android.internal.os.BaseCommand;
-
-import java.io.PrintStream;
-
-public final class Dpm extends BaseCommand {
-
- /**
- * Command-line entry point.
- *
- * @param args The command-line arguments
- */
- public static void main(String[] args) {
- (new Dpm()).run(args);
- }
-
- private static final String COMMAND_SET_ACTIVE_ADMIN = "set-active-admin";
- private static final String COMMAND_SET_DEVICE_OWNER = "set-device-owner";
- private static final String COMMAND_SET_PROFILE_OWNER = "set-profile-owner";
- private static final String COMMAND_REMOVE_ACTIVE_ADMIN = "remove-active-admin";
- private static final String COMMAND_CLEAR_FREEZE_PERIOD_RECORD = "clear-freeze-period-record";
- private static final String COMMAND_FORCE_NETWORK_LOGS = "force-network-logs";
- private static final String COMMAND_FORCE_SECURITY_LOGS = "force-security-logs";
- private static final String COMMAND_MARK_PO_ON_ORG_OWNED_DEVICE =
- "mark-profile-owner-on-organization-owned-device";
-
- private IDevicePolicyManager mDevicePolicyManager;
- private int mUserId = UserHandle.USER_SYSTEM;
- private String mName = "";
- private ComponentName mComponent = null;
-
- @Override
- public void onShowUsage(PrintStream out) {
- out.println(
- "usage: dpm [subcommand] [options]\n" +
- "usage: dpm set-active-admin [ --user <USER_ID> | current ] <COMPONENT>\n" +
- // STOPSHIP Finalize it
- "usage: dpm set-device-owner [ --user <USER_ID> | current *EXPERIMENTAL* ] " +
- "[ --name <NAME> ] <COMPONENT>\n" +
- "usage: dpm set-profile-owner [ --user <USER_ID> | current ] [ --name <NAME> ] " +
- "<COMPONENT>\n" +
- "usage: dpm remove-active-admin [ --user <USER_ID> | current ] [ --name <NAME> ] " +
- "<COMPONENT>\n" +
- "\n" +
- "dpm set-active-admin: Sets the given component as active admin" +
- " for an existing user.\n" +
- "\n" +
- "dpm set-device-owner: Sets the given component as active admin, and its" +
- " package as device owner.\n" +
- "\n" +
- "dpm set-profile-owner: Sets the given component as active admin and profile" +
- " owner for an existing user.\n" +
- "\n" +
- "dpm remove-active-admin: Disables an active admin, the admin must have declared" +
- " android:testOnly in the application in its manifest. This will also remove" +
- " device and profile owners.\n" +
- "\n" +
- "dpm " + COMMAND_CLEAR_FREEZE_PERIOD_RECORD + ": clears framework-maintained " +
- "record of past freeze periods that the device went through. For use during " +
- "feature development to prevent triggering restriction on setting freeze " +
- "periods.\n" +
- "\n" +
- "dpm " + COMMAND_FORCE_NETWORK_LOGS + ": makes all network logs available to " +
- "the DPC and triggers DeviceAdminReceiver.onNetworkLogsAvailable() if needed.\n" +
- "\n" +
- "dpm " + COMMAND_FORCE_SECURITY_LOGS + ": makes all security logs available to " +
- "the DPC and triggers DeviceAdminReceiver.onSecurityLogsAvailable() if needed."
- + "\n"
- + "usage: dpm " + COMMAND_MARK_PO_ON_ORG_OWNED_DEVICE + ": "
- + "[ --user <USER_ID> | current ] <COMPONENT>\n");
- }
-
- @Override
- public void onRun() throws Exception {
- mDevicePolicyManager = IDevicePolicyManager.Stub.asInterface(
- ServiceManager.getService(Context.DEVICE_POLICY_SERVICE));
- if (mDevicePolicyManager == null) {
- showError("Error: Could not access the Device Policy Manager. Is the system running?");
- return;
- }
-
- String command = nextArgRequired();
- switch (command) {
- case COMMAND_SET_ACTIVE_ADMIN:
- runSetActiveAdmin();
- break;
- case COMMAND_SET_DEVICE_OWNER:
- runSetDeviceOwner();
- break;
- case COMMAND_SET_PROFILE_OWNER:
- runSetProfileOwner();
- break;
- case COMMAND_REMOVE_ACTIVE_ADMIN:
- runRemoveActiveAdmin();
- break;
- case COMMAND_CLEAR_FREEZE_PERIOD_RECORD:
- runClearFreezePeriodRecord();
- break;
- case COMMAND_FORCE_NETWORK_LOGS:
- runForceNetworkLogs();
- break;
- case COMMAND_FORCE_SECURITY_LOGS:
- runForceSecurityLogs();
- break;
- case COMMAND_MARK_PO_ON_ORG_OWNED_DEVICE:
- runMarkProfileOwnerOnOrganizationOwnedDevice();
- break;
- default:
- throw new IllegalArgumentException ("unknown command '" + command + "'");
- }
- }
-
- private void runForceNetworkLogs() throws RemoteException, InterruptedException {
- while (true) {
- final long toWait = mDevicePolicyManager.forceNetworkLogs();
- if (toWait == 0) {
- break;
- }
- System.out.println("We have to wait for " + toWait + " milliseconds...");
- Thread.sleep(toWait);
- }
- System.out.println("Success");
- }
-
- private void runForceSecurityLogs() throws RemoteException, InterruptedException {
- while (true) {
- final long toWait = mDevicePolicyManager.forceSecurityLogs();
- if (toWait == 0) {
- break;
- }
- System.out.println("We have to wait for " + toWait + " milliseconds...");
- Thread.sleep(toWait);
- }
- System.out.println("Success");
- }
-
- private void parseArgs(boolean canHaveName) {
- String opt;
- while ((opt = nextOption()) != null) {
- if ("--user".equals(opt)) {
- String arg = nextArgRequired();
- if ("current".equals(arg) || "cur".equals(arg)) {
- mUserId = UserHandle.USER_CURRENT;
- } else {
- mUserId = parseInt(arg);
- }
- if (mUserId == UserHandle.USER_CURRENT) {
- IActivityManager activityManager = ActivityManager.getService();
- try {
- mUserId = activityManager.getCurrentUser().id;
- } catch (RemoteException e) {
- e.rethrowAsRuntimeException();
- }
- }
- } else if (canHaveName && "--name".equals(opt)) {
- mName = nextArgRequired();
- } else {
- throw new IllegalArgumentException("Unknown option: " + opt);
- }
- }
- mComponent = parseComponentName(nextArgRequired());
- }
-
- private void runSetActiveAdmin() throws RemoteException {
- parseArgs(/*canHaveName=*/ false);
- mDevicePolicyManager.setActiveAdmin(mComponent, true /*refreshing*/, mUserId);
-
- System.out.println("Success: Active admin set to component " + mComponent.toShortString());
- }
-
- private void runSetDeviceOwner() throws RemoteException {
- parseArgs(/*canHaveName=*/ true);
- mDevicePolicyManager.setActiveAdmin(mComponent, true /*refreshing*/, mUserId);
-
- try {
- if (!mDevicePolicyManager.setDeviceOwner(mComponent, mName, mUserId)) {
- throw new RuntimeException(
- "Can't set package " + mComponent + " as device owner.");
- }
- } catch (Exception e) {
- // Need to remove the admin that we just added.
- mDevicePolicyManager.removeActiveAdmin(mComponent, UserHandle.USER_SYSTEM);
- throw e;
- }
-
- mDevicePolicyManager.setUserProvisioningState(
- DevicePolicyManager.STATE_USER_SETUP_FINALIZED, mUserId);
-
- System.out.println("Success: Device owner set to package " + mComponent);
- System.out.println("Active admin set to component " + mComponent.toShortString());
- }
-
- private void runRemoveActiveAdmin() throws RemoteException {
- parseArgs(/*canHaveName=*/ false);
- mDevicePolicyManager.forceRemoveActiveAdmin(mComponent, mUserId);
- System.out.println("Success: Admin removed " + mComponent);
- }
-
- private void runSetProfileOwner() throws RemoteException {
- parseArgs(/*canHaveName=*/ true);
- mDevicePolicyManager.setActiveAdmin(mComponent, true /*refreshing*/, mUserId);
-
- try {
- if (!mDevicePolicyManager.setProfileOwner(mComponent, mName, mUserId)) {
- throw new RuntimeException("Can't set component " + mComponent.toShortString() +
- " as profile owner for user " + mUserId);
- }
- } catch (Exception e) {
- // Need to remove the admin that we just added.
- mDevicePolicyManager.removeActiveAdmin(mComponent, mUserId);
- throw e;
- }
-
- mDevicePolicyManager.setUserProvisioningState(
- DevicePolicyManager.STATE_USER_SETUP_FINALIZED, mUserId);
-
- System.out.println("Success: Active admin and profile owner set to "
- + mComponent.toShortString() + " for user " + mUserId);
- }
-
- private void runClearFreezePeriodRecord() throws RemoteException {
- mDevicePolicyManager.clearSystemUpdatePolicyFreezePeriodRecord();
- System.out.println("Success");
- }
-
-
- private void runMarkProfileOwnerOnOrganizationOwnedDevice() throws RemoteException {
- parseArgs(/*canHaveName=*/ false);
- mDevicePolicyManager.markProfileOwnerOnOrganizationOwnedDevice(mComponent, mUserId);
- System.out.println("Success");
- }
-
- private ComponentName parseComponentName(String component) {
- ComponentName cn = ComponentName.unflattenFromString(component);
- if (cn == null) {
- throw new IllegalArgumentException ("Invalid component " + component);
- }
- return cn;
- }
-
- private int parseInt(String argument) {
- try {
- return Integer.parseInt(argument);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException ("Invalid integer argument '" + argument + "'", e);
- }
- }
-}
diff --git a/cmds/idmap2/idmap2d/aidl/services/android/os/OverlayablePolicy.aidl b/cmds/idmap2/idmap2d/aidl/services/android/os/OverlayablePolicy.aidl
index 403d8c55de16..a47b8416dbf5 100644
--- a/cmds/idmap2/idmap2d/aidl/services/android/os/OverlayablePolicy.aidl
+++ b/cmds/idmap2/idmap2d/aidl/services/android/os/OverlayablePolicy.aidl
@@ -20,14 +20,16 @@ package android.os;
* @see ResourcesTypes.h ResTable_overlayable_policy_header::PolicyFlags
* @hide
*/
-interface OverlayablePolicy {
- const int PUBLIC = 0x00000001;
- const int SYSTEM_PARTITION = 0x00000002;
- const int VENDOR_PARTITION = 0x00000004;
- const int PRODUCT_PARTITION = 0x00000008;
- const int SIGNATURE = 0x00000010;
- const int ODM_PARTITION = 0x00000020;
- const int OEM_PARTITION = 0x00000040;
- const int ACTOR_SIGNATURE = 0x00000080;
- const int CONFIG_SIGNATURE = 0x0000100;
+@Backing(type="int")
+enum OverlayablePolicy {
+ NONE = 0x00000000,
+ PUBLIC = 0x00000001,
+ SYSTEM_PARTITION = 0x00000002,
+ VENDOR_PARTITION = 0x00000004,
+ PRODUCT_PARTITION = 0x00000008,
+ SIGNATURE = 0x00000010,
+ ODM_PARTITION = 0x00000020,
+ OEM_PARTITION = 0x00000040,
+ ACTOR_SIGNATURE = 0x00000080,
+ CONFIG_SIGNATURE = 0x0000100,
}
diff --git a/cmds/locksettings/TEST_MAPPING b/cmds/locksettings/TEST_MAPPING
index c1cba5f7f22d..7a449effdf76 100644
--- a/cmds/locksettings/TEST_MAPPING
+++ b/cmds/locksettings/TEST_MAPPING
@@ -1,5 +1,5 @@
{
- "presubmit": [
+ "presubmit-large": [
{
"name": "CtsDevicePolicyManagerTestCases",
"options": [
diff --git a/cmds/sm/src/com/android/commands/sm/Sm.java b/cmds/sm/src/com/android/commands/sm/Sm.java
index 260c8a47ea3c..f5bee6c0c724 100644
--- a/cmds/sm/src/com/android/commands/sm/Sm.java
+++ b/cmds/sm/src/com/android/commands/sm/Sm.java
@@ -258,7 +258,7 @@ public final class Sm {
public void runDisableAppDataIsolation() throws RemoteException {
if (!SystemProperties.getBoolean(
- ANDROID_VOLD_APP_DATA_ISOLATION_ENABLED_PROPERTY, false)) {
+ ANDROID_VOLD_APP_DATA_ISOLATION_ENABLED_PROPERTY, true)) {
throw new IllegalStateException("Storage app data isolation is not enabled.");
}
final String pkgName = nextArg();
diff --git a/cmds/uiautomator/library/Android.bp b/cmds/uiautomator/library/Android.bp
index 469b45201337..cffc07859998 100644
--- a/cmds/uiautomator/library/Android.bp
+++ b/cmds/uiautomator/library/Android.bp
@@ -59,8 +59,8 @@ droiddoc {
"android.test.runner",
"junit",
"android.test.base",
- "unsupportedappusage",
],
+ sdk_version: "current",
installable: false,
custom_template: "droiddoc-templates-sdk",
}