API review followup: DynamicAndroidClient
Some API changes per API reivew:
- Move DynamicAndroidClient and ~Manager to android.os.image.
- Rename them to DynamicSystemClient and ~Manager.
- Rename permission MANAGE_DYNAMIC_ANDROID to MANAGE_DYNAMIC_SYSTEM
- Corresponding changes in the installation service.
- Corresponding changes in privapp-permissions-platform.xml.
- Add missing annotations.
- Change setOnStatusChangedListener's parameters order.
- Improve documentations.
- Re-generate api/system-current.txt.
Bug: 126613281
Test: adb shell am
Change-Id: Ia920e9ccf6de1dbbd38c52910cb72cb81b9b5b32
diff --git a/Android.bp b/Android.bp
index c571fa0..93788ee 100644
--- a/Android.bp
+++ b/Android.bp
@@ -248,7 +248,6 @@
"core/java/android/os/ICancellationSignal.aidl",
"core/java/android/os/IDeviceIdentifiersPolicyService.aidl",
"core/java/android/os/IDeviceIdleController.aidl",
- "core/java/android/os/IDynamicAndroidService.aidl",
"core/java/android/os/IHardwarePropertiesManager.aidl",
":libincident_aidl",
"core/java/android/os/IMaintenanceActivityListener.aidl",
@@ -272,6 +271,7 @@
"core/java/android/os/IUserManager.aidl",
":libvibrator_aidl",
"core/java/android/os/IVibratorService.aidl",
+ "core/java/android/os/image/IDynamicSystemService.aidl",
"core/java/android/os/storage/IStorageManager.aidl",
"core/java/android/os/storage/IStorageEventListener.aidl",
"core/java/android/os/storage/IStorageShutdownObserver.aidl",
diff --git a/api/system-current.txt b/api/system-current.txt
index 0154e28..32ddab9 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -1349,7 +1349,6 @@
field public static final String BACKUP_SERVICE = "backup";
field public static final String CONTENT_SUGGESTIONS_SERVICE = "content_suggestions";
field public static final String CONTEXTHUB_SERVICE = "contexthub";
- field public static final String DYNAMIC_ANDROID_SERVICE = "dynamic_android";
field public static final String EUICC_CARD_SERVICE = "euicc_card";
field public static final String HDMI_CONTROL_SERVICE = "hdmi_control";
field public static final String NETD_SERVICE = "netd";
@@ -1376,32 +1375,6 @@
method public void sendOrderedBroadcast(android.content.Intent, String, android.os.Bundle, android.content.BroadcastReceiver, android.os.Handler, int, String, android.os.Bundle);
}
- public class DynamicAndroidClient {
- ctor public DynamicAndroidClient(@NonNull android.content.Context);
- method public void bind();
- method public void setOnStatusChangedListener(@NonNull android.content.DynamicAndroidClient.OnStatusChangedListener, @NonNull java.util.concurrent.Executor);
- method public void setOnStatusChangedListener(@NonNull android.content.DynamicAndroidClient.OnStatusChangedListener);
- method public void start(String, long);
- method public void start(String, long, long);
- method public void unbind();
- field public static final int CAUSE_ERROR_EXCEPTION = 6; // 0x6
- field public static final int CAUSE_ERROR_INVALID_URL = 4; // 0x4
- field public static final int CAUSE_ERROR_IO = 3; // 0x3
- field public static final int CAUSE_ERROR_IPC = 5; // 0x5
- field public static final int CAUSE_INSTALL_CANCELLED = 2; // 0x2
- field public static final int CAUSE_INSTALL_COMPLETED = 1; // 0x1
- field public static final int CAUSE_NOT_SPECIFIED = 0; // 0x0
- field public static final int STATUS_IN_PROGRESS = 2; // 0x2
- field public static final int STATUS_IN_USE = 4; // 0x4
- field public static final int STATUS_NOT_STARTED = 1; // 0x1
- field public static final int STATUS_READY = 3; // 0x3
- field public static final int STATUS_UNKNOWN = 0; // 0x0
- }
-
- public static interface DynamicAndroidClient.OnStatusChangedListener {
- method public void onStatusChanged(int, int, long);
- }
-
public class Intent implements java.lang.Cloneable android.os.Parcelable {
field public static final String ACTION_BATTERY_LEVEL_CHANGED = "android.intent.action.BATTERY_LEVEL_CHANGED";
field public static final String ACTION_CALL_EMERGENCY = "android.intent.action.CALL_EMERGENCY";
@@ -5662,6 +5635,36 @@
}
+package android.os.image {
+
+ public class DynamicSystemClient {
+ ctor public DynamicSystemClient(@NonNull android.content.Context);
+ method @RequiresPermission("android.permission.MANAGE_DYNAMIC_SYSTEM") public void bind();
+ method public void setOnStatusChangedListener(@NonNull java.util.concurrent.Executor, @NonNull android.os.image.DynamicSystemClient.OnStatusChangedListener);
+ method public void setOnStatusChangedListener(@NonNull android.os.image.DynamicSystemClient.OnStatusChangedListener);
+ method @RequiresPermission("android.permission.MANAGE_DYNAMIC_SYSTEM") public void start(@NonNull String, long);
+ method @RequiresPermission("android.permission.MANAGE_DYNAMIC_SYSTEM") public void start(@NonNull String, long, long);
+ method @RequiresPermission("android.permission.MANAGE_DYNAMIC_SYSTEM") public void unbind();
+ field public static final int CAUSE_ERROR_EXCEPTION = 6; // 0x6
+ field public static final int CAUSE_ERROR_INVALID_URL = 4; // 0x4
+ field public static final int CAUSE_ERROR_IO = 3; // 0x3
+ field public static final int CAUSE_ERROR_IPC = 5; // 0x5
+ field public static final int CAUSE_INSTALL_CANCELLED = 2; // 0x2
+ field public static final int CAUSE_INSTALL_COMPLETED = 1; // 0x1
+ field public static final int CAUSE_NOT_SPECIFIED = 0; // 0x0
+ field public static final int STATUS_IN_PROGRESS = 2; // 0x2
+ field public static final int STATUS_IN_USE = 4; // 0x4
+ field public static final int STATUS_NOT_STARTED = 1; // 0x1
+ field public static final int STATUS_READY = 3; // 0x3
+ field public static final int STATUS_UNKNOWN = 0; // 0x0
+ }
+
+ public static interface DynamicSystemClient.OnStatusChangedListener {
+ method public void onStatusChanged(int, int, long);
+ }
+
+}
+
package android.os.storage {
public class StorageManager {
diff --git a/config/boot-image-profile.txt b/config/boot-image-profile.txt
index d740961..a3776c4 100644
--- a/config/boot-image-profile.txt
+++ b/config/boot-image-profile.txt
@@ -4759,7 +4759,6 @@
HPLandroid/os/IDeviceIdleController$Stub$Proxy;->addPowerSaveTempWhitelistAppForSms(Ljava/lang/String;ILjava/lang/String;)J
HPLandroid/os/IDeviceIdleController$Stub;->getDefaultTransactionName(I)Ljava/lang/String;
HPLandroid/os/IDeviceIdleController$Stub;->onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
-HPLandroid/os/IDynamicAndroidService$Stub;->onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
HPLandroid/os/IHardwarePropertiesManager$Stub;->getDefaultTransactionName(I)Ljava/lang/String;
HPLandroid/os/IHardwarePropertiesManager$Stub;->onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
HPLandroid/os/IInstalld$Stub$Proxy;->clearAppData(Ljava/lang/String;Ljava/lang/String;IIJ)V
@@ -5081,6 +5080,7 @@
HPLandroid/os/health/HealthStatsWriter;->writeParcelableMap(Landroid/os/Parcel;Landroid/util/ArrayMap;)V
HPLandroid/os/health/TimerStat;-><init>(IJ)V
HPLandroid/os/health/TimerStat;->writeToParcel(Landroid/os/Parcel;I)V
+HPLandroid/os/image/IDynamicSystemService$Stub;->onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
HPLandroid/os/storage/IStorageEventListener$Stub$Proxy;->onStorageStateChanged(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
HPLandroid/os/storage/IStorageManager$Stub$Proxy;->allocateBytes(Ljava/lang/String;JILjava/lang/String;)V
HPLandroid/os/storage/IStorageManager$Stub$Proxy;->changeEncryptionPassword(ILjava/lang/String;)I
@@ -24027,7 +24027,6 @@
HSPLandroid/os/IDeviceIdleController$Stub;-><init>()V
HSPLandroid/os/IDeviceIdleController$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/IDeviceIdleController;
HSPLandroid/os/IDumpstate$Stub;-><init>()V
-HSPLandroid/os/IDynamicAndroidService$Stub;-><init>()V
HSPLandroid/os/IExternalVibratorService$Stub;-><init>()V
HSPLandroid/os/IHardwarePropertiesManager$Stub;-><init>()V
HSPLandroid/os/IIncidentCompanion$Stub;-><init>()V
@@ -24837,6 +24836,7 @@
HSPLandroid/os/ZygoteProcess;->zygoteSendArgsAndGetResult(Landroid/os/ZygoteProcess$ZygoteState;ZLjava/util/ArrayList;)Landroid/os/Process$ProcessStartResult;
HSPLandroid/os/health/HealthStatsParceler$1;-><init>()V
HSPLandroid/os/health/TimerStat$1;-><init>()V
+HSPLandroid/os/image/IDynamicSystemService$Stub;-><init>()V
HSPLandroid/os/storage/IStorageEventListener$Stub$Proxy;->asBinder()Landroid/os/IBinder;
HSPLandroid/os/storage/IStorageEventListener$Stub;->asBinder()Landroid/os/IBinder;
HSPLandroid/os/storage/IStorageManager$Stub$Proxy;->getVolumeList(ILjava/lang/String;I)[Landroid/os/storage/StorageVolume;
@@ -47386,7 +47386,6 @@
Landroid/os/DropBoxManager$Entry$1;
Landroid/os/DropBoxManager$Entry;
Landroid/os/DropBoxManager;
-Landroid/os/DynamicAndroidManager;
Landroid/os/Environment$UserEnvironment;
Landroid/os/Environment;
Landroid/os/EventLogTags;
@@ -47428,8 +47427,6 @@
Landroid/os/IDeviceIdleController;
Landroid/os/IDumpstate$Stub;
Landroid/os/IDumpstate;
-Landroid/os/IDynamicAndroidService$Stub;
-Landroid/os/IDynamicAndroidService;
Landroid/os/IExternalVibratorService$Stub;
Landroid/os/IExternalVibratorService;
Landroid/os/IHardwarePropertiesManager$Stub;
@@ -47689,6 +47686,10 @@
Landroid/os/health/SystemHealthManager;
Landroid/os/health/TimerStat$1;
Landroid/os/health/TimerStat;
+Landroid/os/image/DynamicSystemClient;
+Landroid/os/image/DynamicSystemManager;
+Landroid/os/image/IDynamicSystemService$Stub;
+Landroid/os/image/IDynamicSystemService;
Landroid/os/storage/DiskInfo;
Landroid/os/storage/IObbActionListener$Stub;
Landroid/os/storage/IObbActionListener;
diff --git a/config/preloaded-classes b/config/preloaded-classes
index fda028d..abdbab2 100644
--- a/config/preloaded-classes
+++ b/config/preloaded-classes
@@ -2724,7 +2724,6 @@
android.os.DropBoxManager$Entry$1
android.os.DropBoxManager$Entry
android.os.DropBoxManager
-android.os.DynamicAndroidManager
android.os.Environment$UserEnvironment
android.os.Environment
android.os.EventLogTags
@@ -2909,6 +2908,8 @@
android.os.health.SystemHealthManager
android.os.health.TimerStat$1
android.os.health.TimerStat
+android.os.image.DynamicSystemClient
+android.os.image.DynamicSystemManager
android.os.storage.IObbActionListener$Stub
android.os.storage.IObbActionListener
android.os.storage.IStorageManager$Stub$Proxy
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index 4d280b7..d67bfb6 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -131,13 +131,11 @@
import android.os.Build;
import android.os.DeviceIdleManager;
import android.os.DropBoxManager;
-import android.os.DynamicAndroidManager;
import android.os.HardwarePropertiesManager;
import android.os.IBatteryPropertiesRegistrar;
import android.os.IBinder;
import android.os.IDeviceIdleController;
import android.os.IDumpstate;
-import android.os.IDynamicAndroidService;
import android.os.IHardwarePropertiesManager;
import android.os.IPowerManager;
import android.os.IRecoverySystem;
@@ -155,6 +153,8 @@
import android.os.UserManager;
import android.os.Vibrator;
import android.os.health.SystemHealthManager;
+import android.os.image.DynamicSystemManager;
+import android.os.image.IDynamicSystemService;
import android.os.storage.StorageManager;
import android.permission.PermissionControllerManager;
import android.permission.PermissionManager;
@@ -1275,15 +1275,15 @@
IRollbackManager.Stub.asInterface(b));
}});
- registerService(Context.DYNAMIC_ANDROID_SERVICE, DynamicAndroidManager.class,
- new CachedServiceFetcher<DynamicAndroidManager>() {
+ registerService(Context.DYNAMIC_SYSTEM_SERVICE, DynamicSystemManager.class,
+ new CachedServiceFetcher<DynamicSystemManager>() {
@Override
- public DynamicAndroidManager createService(ContextImpl ctx)
+ public DynamicSystemManager createService(ContextImpl ctx)
throws ServiceNotFoundException {
IBinder b = ServiceManager.getServiceOrThrow(
- Context.DYNAMIC_ANDROID_SERVICE);
- return new DynamicAndroidManager(
- IDynamicAndroidService.Stub.asInterface(b));
+ Context.DYNAMIC_SYSTEM_SERVICE);
+ return new DynamicSystemManager(
+ IDynamicSystemService.Stub.asInterface(b));
}});
//CHECKSTYLE:ON IndentationCheck
}
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index fb933b1..310e506 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -4644,11 +4644,10 @@
/**
* Use with {@link #getSystemService(String)} to retrieve an
- * {@link android.os.DynamicAndroidManager}.
+ * {@link android.os.image.DynamicSystemManager}.
* @hide
*/
- @SystemApi
- public static final String DYNAMIC_ANDROID_SERVICE = "dynamic_android";
+ public static final String DYNAMIC_SYSTEM_SERVICE = "dynamic_system";
/**
* Determine whether the given permission is allowed for a particular
diff --git a/core/java/android/content/DynamicAndroidClient.java b/core/java/android/os/image/DynamicSystemClient.java
similarity index 64%
rename from core/java/android/content/DynamicAndroidClient.java
rename to core/java/android/os/image/DynamicSystemClient.java
index 571cba4..33a6ee8 100644
--- a/core/java/android/content/DynamicAndroidClient.java
+++ b/core/java/android/os/image/DynamicSystemClient.java
@@ -13,12 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.content;
+package android.os.image;
+import android.annotation.BytesLong;
import android.annotation.CallbackExecutor;
import android.annotation.IntDef;
import android.annotation.NonNull;
+import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@@ -34,12 +40,28 @@
import java.util.concurrent.Executor;
/**
- * This class contains methods and constants used to start DynamicAndroid
- * installation, and a listener for progress update.
+ * <p>This class contains methods and constants used to start a {@code DynamicSystem} installation,
+ * and a listener for status updates.</p>
+ *
+ * <p>{@code DynamicSystem} allows user to run certified system images in a non destructive manner
+ * without needing to prior OEM unlock. While running in {@code DynamicSystem}, persitent storage
+ * for factory reset protection (FRP) remains unchanged. The new system is installed in a
+ * temporarily allocated partition. After the installation is completed, the device will be running
+ * in the new system on next reboot. Then, when the user reboots the device again, it will leave
+ * {@code DynamicSystem} and go back into the original system. Since the userdata for
+ * {@code DynamicSystem} is also newly created during the installation, running in
+ * {@code DynamicSystem} doesn't change user's app data.</p>
+ *
+ * <p>With {@link #setOnStatusChangedListener}, API users can register an
+ * {@link #OnStatusChangedListener} and get status updates and cause when the installation is
+ * started, stopped, or cancelled. It also sends progress updates during the installation. With
+ * {@link #start}, API users can start an installation with the {@link Uri} to a gzipped system
+ * image. The {@link Uri} can be a web URL or a content Uri to a local path.</p>
+ *
* @hide
*/
@SystemApi
-public class DynamicAndroidClient {
+public class DynamicSystemClient {
/** @hide */
@IntDef(prefix = { "STATUS_" }, value = {
STATUS_UNKNOWN,
@@ -64,23 +86,23 @@
@Retention(RetentionPolicy.SOURCE)
public @interface StatusChangedCause {}
- private static final String TAG = "DynAndroidClient";
+ private static final String TAG = "DynSystemClient";
private static final long DEFAULT_USERDATA_SIZE = (10L << 30);
- /** Listener for installation status update. */
+ /** Listener for installation status updates. */
public interface OnStatusChangedListener {
/**
* This callback is called when installation status is changed, and when the
- * client is {@link #bind} to DynamicAndroid installation service.
+ * client is {@link #bind} to {@code DynamicSystem} installation service.
*
- * @param status status code, also defined in {@code DynamicAndroidClient}.
- * @param cause cause code, also defined in {@code DynamicAndroidClient}.
+ * @param status status code, also defined in {@code DynamicSystemClient}.
+ * @param cause cause code, also defined in {@code DynamicSystemClient}.
* @param progress number of bytes installed.
*/
void onStatusChanged(@InstallationStatus int status, @StatusChangedCause int cause,
- long progress);
+ @BytesLong long progress);
}
/*
@@ -98,7 +120,7 @@
/** Installation is finished but the user has not launched it. */
public static final int STATUS_READY = 3;
- /** Device is running in Dynamic Android. */
+ /** Device is running in {@code DynamicSystem}. */
public static final int STATUS_IN_USE = 4;
/*
@@ -113,7 +135,7 @@
/** Status changed because installation is cancelled. */
public static final int CAUSE_INSTALL_CANCELLED = 2;
- /** Installation failed due to IOException. */
+ /** Installation failed due to {@code IOException}. */
public static final int CAUSE_ERROR_IO = 3;
/** Installation failed because the image URL source is not supported. */
@@ -141,7 +163,7 @@
public static final int MSG_UNREGISTER_LISTENER = 2;
/**
- * Message for status update.
+ * Message for status updates.
* @hide
*/
public static final int MSG_POST_STATUS = 3;
@@ -150,7 +172,7 @@
* Messages keys
*/
/**
- * Message key, for progress update.
+ * Message key, for progress updates.
* @hide
*/
public static final String KEY_INSTALLED_SIZE = "KEY_INSTALLED_SIZE";
@@ -163,14 +185,14 @@
* @hide
*/
public static final String ACTION_START_INSTALL =
- "android.content.action.START_INSTALL";
+ "android.os.image.action.START_INSTALL";
/**
- * Intent action: notify user if we are currently running in Dynamic Android.
+ * Intent action: notify user if we are currently running in {@code DynamicSystem}.
* @hide
*/
public static final String ACTION_NOTIFY_IF_IN_USE =
- "android.content.action.NOTIFY_IF_IN_USE";
+ "android.os.image.action.NOTIFY_IF_IN_USE";
/*
* Intent Keys
@@ -195,16 +217,16 @@
private static class IncomingHandler extends Handler {
- private final WeakReference<DynamicAndroidClient> mWeakClient;
+ private final WeakReference<DynamicSystemClient> mWeakClient;
- IncomingHandler(DynamicAndroidClient service) {
+ IncomingHandler(DynamicSystemClient service) {
super(Looper.getMainLooper());
mWeakClient = new WeakReference<>(service);
}
@Override
public void handleMessage(Message msg) {
- DynamicAndroidClient service = mWeakClient.get();
+ DynamicSystemClient service = mWeakClient.get();
if (service != null) {
service.handleMessage(msg);
@@ -212,9 +234,9 @@
}
}
- private class DynAndroidServiceConnection implements ServiceConnection {
+ private class DynSystemServiceConnection implements ServiceConnection {
public void onServiceConnected(ComponentName className, IBinder service) {
- Slog.v(TAG, "DynAndroidService connected");
+ Slog.v(TAG, "DynSystemService connected");
mService = new Messenger(service);
@@ -232,13 +254,13 @@
}
public void onServiceDisconnected(ComponentName className) {
- Slog.v(TAG, "DynAndroidService disconnected");
+ Slog.v(TAG, "DynSystemService disconnected");
mService = null;
}
}
private final Context mContext;
- private final DynAndroidServiceConnection mConnection;
+ private final DynSystemServiceConnection mConnection;
private final Messenger mMessenger;
private boolean mBound;
@@ -247,12 +269,16 @@
private Messenger mService;
/**
+ * Create a new {@code DynamicSystem} client.
+ *
+ * @param context a {@link Context} will be used to bind the installation service.
+ *
* @hide
*/
@SystemApi
- public DynamicAndroidClient(@NonNull Context context) {
+ public DynamicSystemClient(@NonNull Context context) {
mContext = context;
- mConnection = new DynAndroidServiceConnection();
+ mConnection = new DynSystemServiceConnection();
mMessenger = new Messenger(new IncomingHandler(this));
}
@@ -261,8 +287,8 @@
* the executor.
*/
public void setOnStatusChangedListener(
- @NonNull OnStatusChangedListener listener,
- @NonNull @CallbackExecutor Executor executor) {
+ @NonNull @CallbackExecutor Executor executor,
+ @NonNull OnStatusChangedListener listener) {
mListener = listener;
mExecutor = executor;
}
@@ -278,12 +304,15 @@
}
/**
- * Bind to DynamicAndroidInstallationService.
+ * Bind to {@code DynamicSystem} installation service. Binding to the installation service
+ * allows it to send status updates to {@link #OnStatusChangedListener}. It is recommanded
+ * to bind before calling {@link #start} and get status updates.
*/
+ @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
public void bind() {
Intent intent = new Intent();
- intent.setClassName("com.android.dynandroid",
- "com.android.dynandroid.DynamicAndroidInstallationService");
+ intent.setClassName("com.android.dynsystem",
+ "com.android.dynsystem.DynamicSystemInstallationService");
mContext.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
@@ -291,8 +320,10 @@
}
/**
- * Unbind from DynamicAndroidInstallationService.
+ * Unbind from {@code DynamicSystem} installation service. Unbinding from the installation
+ * service stops it from sending following status updates.
*/
+ @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
public void unbind() {
if (!mBound) {
return;
@@ -315,27 +346,40 @@
}
/**
- * Start installing DynamicAndroid from URL with default userdata size.
+ * Start installing {@code DynamicSystem} from URL with default userdata size.
+ *
+ * Calling this function will first start an Activity to confirm device credential, using
+ * {@link KeyguardManager}. If it's confirmed, the installation service will be started.
+ *
+ * This function doesn't require prior calling {@link #bind}.
*
* @param systemUrl A network URL or a file URL to system image.
* @param systemSize size of system image.
*/
- public void start(String systemUrl, long systemSize) {
+ @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
+ public void start(@NonNull String systemUrl, @BytesLong long systemSize) {
start(systemUrl, systemSize, DEFAULT_USERDATA_SIZE);
}
/**
- * Start installing DynamicAndroid from URL.
+ * Start installing {@code DynamicSystem} from URL.
+ *
+ * Calling this function will first start an Activity to confirm device credential, using
+ * {@link KeyguardManager}. If it's confirmed, the installation service will be started.
+ *
+ * This function doesn't require prior calling {@link #bind}.
*
* @param systemUrl A network URL or a file URL to system image.
* @param systemSize size of system image.
* @param userdataSize bytes reserved for userdata.
*/
- public void start(String systemUrl, long systemSize, long userdataSize) {
+ @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
+ public void start(@NonNull String systemUrl, @BytesLong long systemSize,
+ @BytesLong long userdataSize) {
Intent intent = new Intent();
- intent.setClassName("com.android.dynandroid",
- "com.android.dynandroid.VerificationActivity");
+ intent.setClassName("com.android.dynsystem",
+ "com.android.dynsystem.VerificationActivity");
intent.setAction(ACTION_START_INSTALL);
diff --git a/core/java/android/os/DynamicAndroidManager.java b/core/java/android/os/image/DynamicSystemManager.java
similarity index 81%
rename from core/java/android/os/DynamicAndroidManager.java
rename to core/java/android/os/image/DynamicSystemManager.java
index 5238896..0458c2a 100644
--- a/core/java/android/os/DynamicAndroidManager.java
+++ b/core/java/android/os/image/DynamicSystemManager.java
@@ -14,50 +14,51 @@
* limitations under the License.
*/
-package android.os;
+package android.os.image;
import android.annotation.RequiresPermission;
import android.annotation.SystemService;
import android.content.Context;
import android.gsi.GsiProgress;
+import android.os.RemoteException;
/**
- * The DynamicAndroidManager offers a mechanism to use a new Android image temporarily. After the
+ * The DynamicSystemManager offers a mechanism to use a new system image temporarily. After the
* installation, the device can reboot into this image with a new created /data. This image will
* last until the next reboot and then the device will go back to the original image. However the
* installed image and the new created /data are not deleted but disabled. Thus the application can
* either re-enable the installed image by calling {@link #toggle} or use the {@link #remove} to
* delete it completely. In other words, there are three device states: no installation, installed
- * and running. The procedure to install a DynamicAndroid starts with a {@link #startInstallation},
+ * and running. The procedure to install a DynamicSystem starts with a {@link #startInstallation},
* followed by a series of {@link #write} and ends with a {@link commit}. Once the installation is
* complete, the device state changes from no installation to the installed state and a followed
- * reboot will change its state to running. Note one instance of dynamic android can exist on a
- * given device thus the {@link #startInstallation} will fail if the device is currently running a
- * DynamicAndroid.
+ * reboot will change its state to running. Note one instance of DynamicSystem can exist on a given
+ * device thus the {@link #startInstallation} will fail if the device is currently running a
+ * DynamicSystem.
*
* @hide
*/
-@SystemService(Context.DYNAMIC_ANDROID_SERVICE)
-public class DynamicAndroidManager {
- private static final String TAG = "DynamicAndroidManager";
+@SystemService(Context.DYNAMIC_SYSTEM_SERVICE)
+public class DynamicSystemManager {
+ private static final String TAG = "DynamicSystemManager";
- private final IDynamicAndroidService mService;
+ private final IDynamicSystemService mService;
/** {@hide} */
- public DynamicAndroidManager(IDynamicAndroidService service) {
+ public DynamicSystemManager(IDynamicSystemService service) {
mService = service;
}
- /** The DynamicAndroidManager.Session represents a started session for the installation. */
+ /** The DynamicSystemManager.Session represents a started session for the installation. */
public class Session {
private Session() {}
/**
- * Write a chunk of the DynamicAndroid system image
+ * Write a chunk of the DynamicSystem system image
*
* @return {@code true} if the call succeeds. {@code false} if there is any native runtime
* error.
*/
- @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_ANDROID)
+ @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
public boolean write(byte[] buf) {
try {
return mService.write(buf);
@@ -72,7 +73,7 @@
* @return {@code true} if the call succeeds. {@code false} if there is any native runtime
* error.
*/
- @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_ANDROID)
+ @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
public boolean commit() {
try {
return mService.commit();
@@ -82,16 +83,16 @@
}
}
/**
- * Start DynamicAndroid installation. This call may take an unbounded amount of time. The caller
+ * Start DynamicSystem installation. This call may take an unbounded amount of time. The caller
* may use another thread to call the getStartProgress() to get the progress.
*
* @param systemSize system size in bytes
* @param userdataSize userdata size in bytes
* @return {@code true} if the call succeeds. {@code false} either the device does not contain
- * enough space or a DynamicAndroid is currently in use where the {@link #isInUse} would be
+ * enough space or a DynamicSystem is currently in use where the {@link #isInUse} would be
* true.
*/
- @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_ANDROID)
+ @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
public Session startInstallation(long systemSize, long userdataSize) {
try {
if (mService.startInstallation(systemSize, userdataSize)) {
@@ -112,7 +113,7 @@
* status field can be IGsiService.STATUS_NO_OPERATION, IGsiService.STATUS_WORKING or
* IGsiService.STATUS_COMPLETE.
*/
- @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_ANDROID)
+ @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
public GsiProgress getInstallationProgress() {
try {
return mService.getInstallationProgress();
@@ -129,7 +130,7 @@
* @return {@code true} if the call succeeds. {@code false} if there is no installation
* currently.
*/
- @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_ANDROID)
+ @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
public boolean abort() {
try {
return mService.abort();
@@ -138,8 +139,8 @@
}
}
- /** @return {@code true} if the device is running a dynamic android */
- @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_ANDROID)
+ /** @return {@code true} if the device is running a dynamic system */
+ @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
public boolean isInUse() {
try {
return mService.isInUse();
@@ -148,8 +149,8 @@
}
}
- /** @return {@code true} if the device has a dynamic android installed */
- @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_ANDROID)
+ /** @return {@code true} if the device has a dynamic system installed */
+ @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
public boolean isInstalled() {
try {
return mService.isInstalled();
@@ -159,11 +160,11 @@
}
/**
- * Remove DynamicAndroid installation if present
+ * Remove DynamicSystem installation if present
*
* @return {@code true} if the call succeeds. {@code false} if there is no installed image.
*/
- @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_ANDROID)
+ @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
public boolean remove() {
try {
return mService.remove();
@@ -173,11 +174,11 @@
}
/**
- * Enable DynamicAndroid when it's not enabled, otherwise, disable it.
+ * Enable DynamicSystem when it's not enabled, otherwise, disable it.
*
* @return {@code true} if the call succeeds. {@code false} if there is no installed image.
*/
- @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_ANDROID)
+ @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
public boolean toggle() {
try {
return mService.toggle();
diff --git a/core/java/android/os/IDynamicAndroidService.aidl b/core/java/android/os/image/IDynamicSystemService.aidl
similarity index 83%
rename from core/java/android/os/IDynamicAndroidService.aidl
rename to core/java/android/os/image/IDynamicSystemService.aidl
index 0b28799..15f5b68 100644
--- a/core/java/android/os/IDynamicAndroidService.aidl
+++ b/core/java/android/os/image/IDynamicSystemService.aidl
@@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.os;
+package android.os.image;
import android.gsi.GsiProgress;
/** {@hide} */
-interface IDynamicAndroidService
+interface IDynamicSystemService
{
/**
- * Start DynamicAndroid installation. This call may take 60~90 seconds. The caller
+ * Start DynamicSystem installation. This call may take 60~90 seconds. The caller
* may use another thread to call the getStartProgress() to get the progress.
*
* @param systemSize system size in bytes
@@ -53,26 +53,26 @@
boolean isInUse();
/**
- * @return true if the device has an DynamicAndroid image installed
+ * @return true if the device has an DynamicSystem image installed
*/
boolean isInstalled();
/**
- * Remove DynamicAndroid installation if present
+ * Remove DynamicSystem installation if present
*
* @return true if the call succeeds
*/
boolean remove();
/**
- * Enable DynamicAndroid when it's not enabled, otherwise, disable it.
+ * Enable DynamicSystem when it's not enabled, otherwise, disable it.
*
* @return true if the call succeeds
*/
boolean toggle();
/**
- * Write a chunk of the DynamicAndroid system image
+ * Write a chunk of the DynamicSystem system image
*
* @return true if the call succeeds
*/
diff --git a/core/java/android/util/FeatureFlagUtils.java b/core/java/android/util/FeatureFlagUtils.java
index de10ffb..04bb0e3 100644
--- a/core/java/android/util/FeatureFlagUtils.java
+++ b/core/java/android/util/FeatureFlagUtils.java
@@ -52,7 +52,7 @@
DEFAULT_FLAGS.put("settings_slice_injection", "true");
DEFAULT_FLAGS.put("settings_systemui_theme", "true");
DEFAULT_FLAGS.put("settings_mainline_module", "true");
- DEFAULT_FLAGS.put("settings_dynamic_android", "false");
+ DEFAULT_FLAGS.put("settings_dynamic_system", "false");
DEFAULT_FLAGS.put(SEAMLESS_TRANSFER, "false");
DEFAULT_FLAGS.put(HEARING_AID_SETTINGS, "false");
DEFAULT_FLAGS.put(SAFETY_HUB, "false");
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 5427147..e944eeb 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -1849,8 +1849,8 @@
<permission android:name="android.permission.HARDWARE_TEST"
android:protectionLevel="signature" />
- <!-- @hide Allows an application to manage DynamicAndroid image -->
- <permission android:name="android.permission.MANAGE_DYNAMIC_ANDROID"
+ <!-- @hide Allows an application to manage DynamicSystem image -->
+ <permission android:name="android.permission.MANAGE_DYNAMIC_SYSTEM"
android:protectionLevel="signature" />
<!-- @SystemApi Allows access to Broadcast Radio
diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml
index fcd5d56..8b0ac78 100644
--- a/data/etc/privapp-permissions-platform.xml
+++ b/data/etc/privapp-permissions-platform.xml
@@ -329,9 +329,9 @@
<permission name="android.permission.CONTROL_VPN"/>
</privapp-permissions>
- <privapp-permissions package="com.android.dynandroid">
+ <privapp-permissions package="com.android.dynsystem">
<permission name="android.permission.REBOOT"/>
- <permission name="android.permission.MANAGE_DYNAMIC_ANDROID"/>
+ <permission name="android.permission.MANAGE_DYNAMIC_SYSTEM"/>
</privapp-permissions>
</permissions>
diff --git a/packages/DynamicAndroidInstallationService/Android.mk b/packages/DynamicSystemInstallationService/Android.mk
similarity index 86%
rename from packages/DynamicAndroidInstallationService/Android.mk
rename to packages/DynamicSystemInstallationService/Android.mk
index 13d96ac..16aca1b 100644
--- a/packages/DynamicAndroidInstallationService/Android.mk
+++ b/packages/DynamicSystemInstallationService/Android.mk
@@ -8,7 +8,7 @@
LOCAL_USE_AAPT2 := true
-LOCAL_PACKAGE_NAME := DynamicAndroidInstallationService
+LOCAL_PACKAGE_NAME := DynamicSystemInstallationService
LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true
LOCAL_PRIVATE_PLATFORM_APIS := true
diff --git a/packages/DynamicAndroidInstallationService/AndroidManifest.xml b/packages/DynamicSystemInstallationService/AndroidManifest.xml
similarity index 80%
rename from packages/DynamicAndroidInstallationService/AndroidManifest.xml
rename to packages/DynamicSystemInstallationService/AndroidManifest.xml
index 32acad4..2911117 100644
--- a/packages/DynamicAndroidInstallationService/AndroidManifest.xml
+++ b/packages/DynamicSystemInstallationService/AndroidManifest.xml
@@ -1,10 +1,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.dynandroid"
+ package="com.android.dynsystem"
android:sharedUserId="android.uid.system">
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.MANAGE_DYNAMIC_ANDROID" />
+ <uses-permission android:name="android.permission.MANAGE_DYNAMIC_SYSTEM" />
<uses-permission android:name="android.permission.REBOOT" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
@@ -13,24 +13,24 @@
android:label="@string/app_name">
<service
- android:name=".DynamicAndroidInstallationService"
+ android:name=".DynamicSystemInstallationService"
android:enabled="true"
android:exported="true"
- android:permission="android.permission.MANAGE_DYNAMIC_ANDROID"
- android:process=":dynandroid">
+ android:permission="android.permission.MANAGE_DYNAMIC_SYSTEM"
+ android:process=":dynsystem">
<intent-filter>
- <action android:name="android.content.action.NOTIFY_IF_IN_USE" />
+ <action android:name="android.os.image.action.NOTIFY_IF_IN_USE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<activity android:name=".VerificationActivity"
android:exported="true"
- android:permission="android.permission.MANAGE_DYNAMIC_ANDROID"
+ android:permission="android.permission.MANAGE_DYNAMIC_SYSTEM"
android:theme="@android:style/Theme.Material.Light.Dialog.NoActionBar"
- android:process=":dynandroid">
+ android:process=":dynsystem">
<intent-filter>
- <action android:name="android.content.action.START_INSTALL" />
+ <action android:name="android.os.image.action.START_INSTALL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
diff --git a/packages/DynamicAndroidInstallationService/MODULE_LICENSE_APACHE2 b/packages/DynamicSystemInstallationService/MODULE_LICENSE_APACHE2
similarity index 100%
rename from packages/DynamicAndroidInstallationService/MODULE_LICENSE_APACHE2
rename to packages/DynamicSystemInstallationService/MODULE_LICENSE_APACHE2
diff --git a/packages/DynamicAndroidInstallationService/NOTICE b/packages/DynamicSystemInstallationService/NOTICE
similarity index 100%
rename from packages/DynamicAndroidInstallationService/NOTICE
rename to packages/DynamicSystemInstallationService/NOTICE
diff --git a/packages/DynamicAndroidInstallationService/res/drawable/ic_system_update_googblue_24dp.xml b/packages/DynamicSystemInstallationService/res/drawable/ic_system_update_googblue_24dp.xml
similarity index 100%
rename from packages/DynamicAndroidInstallationService/res/drawable/ic_system_update_googblue_24dp.xml
rename to packages/DynamicSystemInstallationService/res/drawable/ic_system_update_googblue_24dp.xml
diff --git a/packages/DynamicAndroidInstallationService/res/values/strings.xml b/packages/DynamicSystemInstallationService/res/values/strings.xml
similarity index 64%
rename from packages/DynamicAndroidInstallationService/res/values/strings.xml
rename to packages/DynamicSystemInstallationService/res/values/strings.xml
index 03c7c28..a72e4e2 100644
--- a/packages/DynamicAndroidInstallationService/res/values/strings.xml
+++ b/packages/DynamicSystemInstallationService/res/values/strings.xml
@@ -12,14 +12,14 @@
<!-- password page description [CHAR LIMIT=128] -->
<string name="keyguard_description">Please enter your password and continue to AndroidOnTap installation</string>
- <!-- Displayed on notification: DynAndroid installation is completed [CHAR LIMIT=128] -->
+ <!-- Displayed on notification: AndroidOnTap installation is completed [CHAR LIMIT=128] -->
<string name="notification_install_completed">New system is ready, you can reboot into it or discard it.</string>
- <!-- Displayed on notification: DynAndroid installation is in progress [CHAR LIMIT=128] -->
+ <!-- Displayed on notification: AndroidOnTap installation is in progress [CHAR LIMIT=128] -->
<string name="notification_install_inprogress">Installation is in progress.</string>
- <!-- Displayed on notification: DynAndroid installation is in progress [CHAR LIMIT=128] -->
+ <!-- Displayed on notification: AndroidOnTap installation is in progress [CHAR LIMIT=128] -->
<string name="notification_install_failed">Installation Failed.</string>
<!-- Displayed on notification: We are running in AndroidOnTap [CHAR LIMIT=128] -->
- <string name="notification_dynandroid_in_use">We are running in AndroidOnTap.</string>
+ <string name="notification_dynsystem_in_use">We are running in AndroidOnTap.</string>
<!-- Action on notification: Cancel installation [CHAR LIMIT=16] -->
<string name="notification_action_cancel">Cancel</string>
@@ -28,11 +28,11 @@
<!-- Action on notification: Uninstall AndroidOnTap [CHAR LIMIT=16] -->
<string name="notification_action_uninstall">Uninstall</string>
<!-- Action on notification: Reboot to AndroidOnTap [CHAR LIMIT=16] -->
- <string name="notification_action_reboot_to_dynandroid">Reboot</string>
+ <string name="notification_action_reboot_to_dynsystem">Reboot</string>
- <!-- Toast when installed DynamicAndroid is discarded [CHAR LIMIT=64] -->
- <string name="toast_dynandroid_discarded">Installed AndroidOnTap is discarded.</string>
- <!-- Toast when we fail to launch into DynamicAndroid [CHAR LIMIT=64] -->
- <string name="toast_failed_to_reboot_to_dynandroid">Failed to reboot into AndroidOnTap.</string>
+ <!-- Toast when installed AndroidOnTap is discarded [CHAR LIMIT=64] -->
+ <string name="toast_dynsystem_discarded">Installed AndroidOnTap is discarded.</string>
+ <!-- Toast when we fail to launch into AndroidOnTap [CHAR LIMIT=64] -->
+ <string name="toast_failed_to_reboot_to_dynsystem">Failed to reboot into AndroidOnTap.</string>
</resources>
diff --git a/packages/DynamicAndroidInstallationService/src/com/android/dynandroid/BootCompletedReceiver.java b/packages/DynamicSystemInstallationService/src/com/android/dynandroid/BootCompletedReceiver.java
similarity index 84%
rename from packages/DynamicAndroidInstallationService/src/com/android/dynandroid/BootCompletedReceiver.java
rename to packages/DynamicSystemInstallationService/src/com/android/dynandroid/BootCompletedReceiver.java
index dd1be89..38576ee 100644
--- a/packages/DynamicAndroidInstallationService/src/com/android/dynandroid/BootCompletedReceiver.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynandroid/BootCompletedReceiver.java
@@ -14,20 +14,20 @@
* limitations under the License.
*/
-package com.android.dynandroid;
+package com.android.dynsystem;
import android.content.BroadcastReceiver;
import android.content.Context;
-import android.content.DynamicAndroidClient;
import android.content.Intent;
import android.os.UserHandle;
+import android.os.image.DynamicSystemClient;
import android.util.Log;
/**
* A BoardcastReceiver waiting for ACTION_BOOT_COMPLETED and ask
* the service to display a notification if we are currently running
- * in DynamicAndroid.
+ * in DynamicSystem.
*/
public class BootCompletedReceiver extends BroadcastReceiver {
@@ -41,9 +41,9 @@
if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
Intent startServiceIntent = new Intent(
- context, DynamicAndroidInstallationService.class);
+ context, DynamicSystemInstallationService.class);
- startServiceIntent.setAction(DynamicAndroidClient.ACTION_NOTIFY_IF_IN_USE);
+ startServiceIntent.setAction(DynamicSystemClient.ACTION_NOTIFY_IF_IN_USE);
context.startServiceAsUser(startServiceIntent, UserHandle.SYSTEM);
}
}
diff --git a/packages/DynamicAndroidInstallationService/src/com/android/dynandroid/DynamicAndroidInstallationService.java b/packages/DynamicSystemInstallationService/src/com/android/dynandroid/DynamicSystemInstallationService.java
similarity index 78%
rename from packages/DynamicAndroidInstallationService/src/com/android/dynandroid/DynamicAndroidInstallationService.java
rename to packages/DynamicSystemInstallationService/src/com/android/dynandroid/DynamicSystemInstallationService.java
index d942bab..df2c571 100644
--- a/packages/DynamicAndroidInstallationService/src/com/android/dynandroid/DynamicAndroidInstallationService.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynandroid/DynamicSystemInstallationService.java
@@ -14,28 +14,28 @@
* limitations under the License.
*/
-package com.android.dynandroid;
+package com.android.dynsystem;
-import static android.content.DynamicAndroidClient.ACTION_NOTIFY_IF_IN_USE;
-import static android.content.DynamicAndroidClient.ACTION_START_INSTALL;
-import static android.content.DynamicAndroidClient.CAUSE_ERROR_EXCEPTION;
-import static android.content.DynamicAndroidClient.CAUSE_ERROR_INVALID_URL;
-import static android.content.DynamicAndroidClient.CAUSE_ERROR_IO;
-import static android.content.DynamicAndroidClient.CAUSE_INSTALL_CANCELLED;
-import static android.content.DynamicAndroidClient.CAUSE_INSTALL_COMPLETED;
-import static android.content.DynamicAndroidClient.CAUSE_NOT_SPECIFIED;
-import static android.content.DynamicAndroidClient.STATUS_IN_PROGRESS;
-import static android.content.DynamicAndroidClient.STATUS_IN_USE;
-import static android.content.DynamicAndroidClient.STATUS_NOT_STARTED;
-import static android.content.DynamicAndroidClient.STATUS_READY;
import static android.os.AsyncTask.Status.FINISHED;
import static android.os.AsyncTask.Status.PENDING;
import static android.os.AsyncTask.Status.RUNNING;
+import static android.os.image.DynamicSystemClient.ACTION_NOTIFY_IF_IN_USE;
+import static android.os.image.DynamicSystemClient.ACTION_START_INSTALL;
+import static android.os.image.DynamicSystemClient.CAUSE_ERROR_EXCEPTION;
+import static android.os.image.DynamicSystemClient.CAUSE_ERROR_INVALID_URL;
+import static android.os.image.DynamicSystemClient.CAUSE_ERROR_IO;
+import static android.os.image.DynamicSystemClient.CAUSE_INSTALL_CANCELLED;
+import static android.os.image.DynamicSystemClient.CAUSE_INSTALL_COMPLETED;
+import static android.os.image.DynamicSystemClient.CAUSE_NOT_SPECIFIED;
+import static android.os.image.DynamicSystemClient.STATUS_IN_PROGRESS;
+import static android.os.image.DynamicSystemClient.STATUS_IN_USE;
+import static android.os.image.DynamicSystemClient.STATUS_NOT_STARTED;
+import static android.os.image.DynamicSystemClient.STATUS_READY;
-import static com.android.dynandroid.InstallationAsyncTask.RESULT_ERROR_EXCEPTION;
-import static com.android.dynandroid.InstallationAsyncTask.RESULT_ERROR_INVALID_URL;
-import static com.android.dynandroid.InstallationAsyncTask.RESULT_ERROR_IO;
-import static com.android.dynandroid.InstallationAsyncTask.RESULT_OK;
+import static com.android.dynsystem.InstallationAsyncTask.RESULT_ERROR_EXCEPTION;
+import static com.android.dynsystem.InstallationAsyncTask.RESULT_ERROR_INVALID_URL;
+import static com.android.dynsystem.InstallationAsyncTask.RESULT_ERROR_IO;
+import static com.android.dynsystem.InstallationAsyncTask.RESULT_OK;
import android.app.Notification;
import android.app.NotificationChannel;
@@ -43,16 +43,16 @@
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
-import android.content.DynamicAndroidClient;
import android.content.Intent;
import android.os.Bundle;
-import android.os.DynamicAndroidManager;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.os.PowerManager;
import android.os.RemoteException;
+import android.os.image.DynamicSystemClient;
+import android.os.image.DynamicSystemManager;
import android.util.Log;
import android.widget.Toast;
@@ -60,31 +60,31 @@
import java.util.ArrayList;
/**
- * This class is the service in charge of DynamicAndroid installation.
+ * This class is the service in charge of DynamicSystem installation.
* It also posts status to notification bar and wait for user's
* cancel and confirm commnands.
*/
-public class DynamicAndroidInstallationService extends Service
+public class DynamicSystemInstallationService extends Service
implements InstallationAsyncTask.InstallStatusListener {
- private static final String TAG = "DynAndroidInstallationService";
+ private static final String TAG = "DynSystemInstallationService";
/*
* Intent actions
*/
private static final String ACTION_CANCEL_INSTALL =
- "com.android.dynandroid.ACTION_CANCEL_INSTALL";
+ "com.android.dynsystem.ACTION_CANCEL_INSTALL";
private static final String ACTION_DISCARD_INSTALL =
- "com.android.dynandroid.ACTION_DISCARD_INSTALL";
- private static final String ACTION_REBOOT_TO_DYN_ANDROID =
- "com.android.dynandroid.ACTION_REBOOT_TO_DYN_ANDROID";
+ "com.android.dynsystem.ACTION_DISCARD_INSTALL";
+ private static final String ACTION_REBOOT_TO_DYN_SYSTEM =
+ "com.android.dynsystem.ACTION_REBOOT_TO_DYN_SYSTEM";
private static final String ACTION_REBOOT_TO_NORMAL =
- "com.android.dynandroid.ACTION_REBOOT_TO_NORMAL";
+ "com.android.dynsystem.ACTION_REBOOT_TO_NORMAL";
/*
* For notification
*/
- private static final String NOTIFICATION_CHANNEL_ID = "com.android.dynandroid";
+ private static final String NOTIFICATION_CHANNEL_ID = "com.android.dynsystem";
private static final int NOTIFICATION_ID = 1;
/*
@@ -97,15 +97,15 @@
final Messenger mMessenger = new Messenger(new IncomingHandler(this));
static class IncomingHandler extends Handler {
- private final WeakReference<DynamicAndroidInstallationService> mWeakService;
+ private final WeakReference<DynamicSystemInstallationService> mWeakService;
- IncomingHandler(DynamicAndroidInstallationService service) {
+ IncomingHandler(DynamicSystemInstallationService service) {
mWeakService = new WeakReference<>(service);
}
@Override
public void handleMessage(Message msg) {
- DynamicAndroidInstallationService service = mWeakService.get();
+ DynamicSystemInstallationService service = mWeakService.get();
if (service != null) {
service.handleMessage(msg);
@@ -113,7 +113,7 @@
}
}
- private DynamicAndroidManager mDynAndroid;
+ private DynamicSystemManager mDynSystem;
private NotificationManager mNM;
private long mSystemSize;
@@ -130,7 +130,7 @@
prepareNotification();
- mDynAndroid = (DynamicAndroidManager) getSystemService(Context.DYNAMIC_ANDROID_SERVICE);
+ mDynSystem = (DynamicSystemManager) getSystemService(Context.DYNAMIC_SYSTEM_SERVICE);
}
@Override
@@ -156,8 +156,8 @@
executeCancelCommand();
} else if (ACTION_DISCARD_INSTALL.equals(action)) {
executeDiscardCommand();
- } else if (ACTION_REBOOT_TO_DYN_ANDROID.equals(action)) {
- executeRebootToDynAndroidCommand();
+ } else if (ACTION_REBOOT_TO_DYN_SYSTEM.equals(action)) {
+ executeRebootToDynSystemCommand();
} else if (ACTION_REBOOT_TO_NORMAL.equals(action)) {
executeRebootToNormalCommand();
} else if (ACTION_NOTIFY_IF_IN_USE.equals(action)) {
@@ -215,17 +215,17 @@
return;
}
- if (isInDynamicAndroid()) {
- Log.e(TAG, "We are already running in DynamicAndroid");
+ if (isInDynamicSystem()) {
+ Log.e(TAG, "We are already running in DynamicSystem");
return;
}
- String url = intent.getStringExtra(DynamicAndroidClient.KEY_SYSTEM_URL);
- mSystemSize = intent.getLongExtra(DynamicAndroidClient.KEY_SYSTEM_SIZE, 0);
- mUserdataSize = intent.getLongExtra(DynamicAndroidClient.KEY_USERDATA_SIZE, 0);
+ String url = intent.getStringExtra(DynamicSystemClient.KEY_SYSTEM_URL);
+ mSystemSize = intent.getLongExtra(DynamicSystemClient.KEY_SYSTEM_SIZE, 0);
+ mUserdataSize = intent.getLongExtra(DynamicSystemClient.KEY_USERDATA_SIZE, 0);
mInstallTask = new InstallationAsyncTask(
- url, mSystemSize, mUserdataSize, mDynAndroid, this);
+ url, mSystemSize, mUserdataSize, mDynSystem, this);
mInstallTask.execute();
@@ -251,7 +251,7 @@
}
private void executeDiscardCommand() {
- if (isInDynamicAndroid()) {
+ if (isInDynamicSystem()) {
Log.e(TAG, "We are now running in AOT, please reboot to normal system first");
return;
}
@@ -262,16 +262,16 @@
}
Toast.makeText(this,
- getString(R.string.toast_dynandroid_discarded),
+ getString(R.string.toast_dynsystem_discarded),
Toast.LENGTH_LONG).show();
resetTaskAndStop();
postStatus(STATUS_NOT_STARTED, CAUSE_INSTALL_CANCELLED);
- mDynAndroid.remove();
+ mDynSystem.remove();
}
- private void executeRebootToDynAndroidCommand() {
+ private void executeRebootToDynSystemCommand() {
if (mInstallTask == null || mInstallTask.getStatus() != FINISHED) {
Log.e(TAG, "Trying to reboot to AOT while there is no complete installation");
return;
@@ -282,10 +282,10 @@
mNM.cancel(NOTIFICATION_ID);
Toast.makeText(this,
- getString(R.string.toast_failed_to_reboot_to_dynandroid),
+ getString(R.string.toast_failed_to_reboot_to_dynsystem),
Toast.LENGTH_LONG).show();
- mDynAndroid.remove();
+ mDynSystem.remove();
return;
}
@@ -293,12 +293,12 @@
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
if (powerManager != null) {
- powerManager.reboot("dynandroid");
+ powerManager.reboot("dynsystem");
}
}
private void executeRebootToNormalCommand() {
- if (!isInDynamicAndroid()) {
+ if (!isInDynamicSystem()) {
Log.e(TAG, "It's already running in normal system.");
return;
}
@@ -346,7 +346,7 @@
}
private PendingIntent createPendingIntent(String action) {
- Intent intent = new Intent(this, DynamicAndroidInstallationService.class);
+ Intent intent = new Intent(this, DynamicSystemInstallationService.class);
intent.setAction(action);
return PendingIntent.getService(this, 0, intent, 0);
}
@@ -375,8 +375,8 @@
builder.setContentText(getString(R.string.notification_install_completed));
builder.addAction(new Notification.Action.Builder(
- null, getString(R.string.notification_action_reboot_to_dynandroid),
- createPendingIntent(ACTION_REBOOT_TO_DYN_ANDROID)).build());
+ null, getString(R.string.notification_action_reboot_to_dynsystem),
+ createPendingIntent(ACTION_REBOOT_TO_DYN_SYSTEM)).build());
builder.addAction(new Notification.Action.Builder(
null, getString(R.string.notification_action_discard),
@@ -385,7 +385,7 @@
break;
case STATUS_IN_USE:
- builder.setContentText(getString(R.string.notification_dynandroid_in_use));
+ builder.setContentText(getString(R.string.notification_dynsystem_in_use));
builder.addAction(new Notification.Action.Builder(
null, getString(R.string.notification_action_uninstall),
@@ -409,7 +409,7 @@
}
private boolean verifyRequest(Intent intent) {
- String url = intent.getStringExtra(DynamicAndroidClient.KEY_SYSTEM_URL);
+ String url = intent.getStringExtra(DynamicSystemClient.KEY_SYSTEM_URL);
return VerificationActivity.isVerified(url);
}
@@ -443,16 +443,16 @@
private void notifyOneClient(Messenger client, int status, int cause) throws RemoteException {
Bundle bundle = new Bundle();
- bundle.putLong(DynamicAndroidClient.KEY_INSTALLED_SIZE, mInstalledSize);
+ bundle.putLong(DynamicSystemClient.KEY_INSTALLED_SIZE, mInstalledSize);
client.send(Message.obtain(null,
- DynamicAndroidClient.MSG_POST_STATUS, status, cause, bundle));
+ DynamicSystemClient.MSG_POST_STATUS, status, cause, bundle));
}
private int getStatus() {
- if (isInDynamicAndroid()) {
+ if (isInDynamicSystem()) {
return STATUS_IN_USE;
- } else if (isDynamicAndroidInstalled()) {
+ } else if (isDynamicSystemInstalled()) {
return STATUS_READY;
} else if (mInstallTask == null) {
return STATUS_NOT_STARTED;
@@ -479,17 +479,17 @@
}
}
- private boolean isInDynamicAndroid() {
- return mDynAndroid.isInUse();
+ private boolean isInDynamicSystem() {
+ return mDynSystem.isInUse();
}
- private boolean isDynamicAndroidInstalled() {
- return mDynAndroid.isInstalled();
+ private boolean isDynamicSystemInstalled() {
+ return mDynSystem.isInstalled();
}
void handleMessage(Message msg) {
switch (msg.what) {
- case DynamicAndroidClient.MSG_REGISTER_LISTENER:
+ case DynamicSystemClient.MSG_REGISTER_LISTENER:
try {
Messenger client = msg.replyTo;
@@ -505,7 +505,7 @@
}
break;
- case DynamicAndroidClient.MSG_UNREGISTER_LISTENER:
+ case DynamicSystemClient.MSG_UNREGISTER_LISTENER:
mClients.remove(msg.replyTo);
break;
default:
diff --git a/packages/DynamicAndroidInstallationService/src/com/android/dynandroid/InstallationAsyncTask.java b/packages/DynamicSystemInstallationService/src/com/android/dynandroid/InstallationAsyncTask.java
similarity index 90%
rename from packages/DynamicAndroidInstallationService/src/com/android/dynandroid/InstallationAsyncTask.java
rename to packages/DynamicSystemInstallationService/src/com/android/dynandroid/InstallationAsyncTask.java
index 03fc773..052fc0a 100644
--- a/packages/DynamicAndroidInstallationService/src/com/android/dynandroid/InstallationAsyncTask.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynandroid/InstallationAsyncTask.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.android.dynandroid;
+package com.android.dynsystem;
import android.gsi.GsiProgress;
import android.os.AsyncTask;
-import android.os.DynamicAndroidManager;
+import android.os.image.DynamicSystemManager;
import android.util.Log;
import android.webkit.URLUtil;
@@ -60,9 +60,9 @@
private final String mUrl;
private final long mSystemSize;
private final long mUserdataSize;
- private final DynamicAndroidManager mDynamicAndroid;
+ private final DynamicSystemManager mDynSystem;
private final InstallStatusListener mListener;
- private DynamicAndroidManager.Session mInstallationSession;
+ private DynamicSystemManager.Session mInstallationSession;
private int mResult = NO_RESULT;
@@ -70,11 +70,11 @@
InstallationAsyncTask(String url, long systemSize, long userdataSize,
- DynamicAndroidManager dynAndroid, InstallStatusListener listener) {
+ DynamicSystemManager dynSystem, InstallStatusListener listener) {
mUrl = url;
mSystemSize = systemSize;
mUserdataSize = userdataSize;
- mDynamicAndroid = dynAndroid;
+ mDynSystem = dynSystem;
mListener = listener;
}
@@ -98,7 +98,7 @@
Thread thread = new Thread(() -> {
mInstallationSession =
- mDynamicAndroid.startInstallation(mSystemSize, mUserdataSize);
+ mDynSystem.startInstallation(mSystemSize, mUserdataSize);
});
@@ -106,12 +106,12 @@
while (thread.isAlive()) {
if (isCancelled()) {
- boolean aborted = mDynamicAndroid.abort();
- Log.d(TAG, "Called DynamicAndroidManager.abort(), result = " + aborted);
+ boolean aborted = mDynSystem.abort();
+ Log.d(TAG, "Called DynamicSystemManager.abort(), result = " + aborted);
return RESULT_OK;
}
- GsiProgress progress = mDynamicAndroid.getInstallationProgress();
+ GsiProgress progress = mDynSystem.getInstallationProgress();
installedSize = progress.bytes_processed;
if (installedSize > reportedInstalledSize + minStepToReport) {
@@ -146,7 +146,7 @@
? bytes : Arrays.copyOf(bytes, numBytesRead);
if (!mInstallationSession.write(writeBuffer)) {
- throw new IOException("Failed write() to DynamicAndroid");
+ throw new IOException("Failed write() to DynamicSystem");
}
installedSize += numBytesRead;
diff --git a/packages/DynamicAndroidInstallationService/src/com/android/dynandroid/VerificationActivity.java b/packages/DynamicSystemInstallationService/src/com/android/dynandroid/VerificationActivity.java
similarity index 87%
rename from packages/DynamicAndroidInstallationService/src/com/android/dynandroid/VerificationActivity.java
rename to packages/DynamicSystemInstallationService/src/com/android/dynandroid/VerificationActivity.java
index c18c4fe..f05930f 100644
--- a/packages/DynamicAndroidInstallationService/src/com/android/dynandroid/VerificationActivity.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynandroid/VerificationActivity.java
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-package com.android.dynandroid;
+package com.android.dynsystem;
-import static android.content.DynamicAndroidClient.KEY_SYSTEM_SIZE;
-import static android.content.DynamicAndroidClient.KEY_SYSTEM_URL;
-import static android.content.DynamicAndroidClient.KEY_USERDATA_SIZE;
+import static android.os.image.DynamicSystemClient.KEY_SYSTEM_SIZE;
+import static android.os.image.DynamicSystemClient.KEY_SYSTEM_URL;
+import static android.os.image.DynamicSystemClient.KEY_USERDATA_SIZE;
import android.app.Activity;
import android.app.KeyguardManager;
import android.content.Context;
-import android.content.DynamicAndroidClient;
import android.content.Intent;
import android.os.Bundle;
import android.os.UserHandle;
+import android.os.image.DynamicSystemClient;
import android.util.Log;
@@ -88,8 +88,8 @@
sVerifiedUrl = url;
// start service
- Intent intent = new Intent(this, DynamicAndroidInstallationService.class);
- intent.setAction(DynamicAndroidClient.ACTION_START_INSTALL);
+ Intent intent = new Intent(this, DynamicSystemInstallationService.class);
+ intent.setAction(DynamicSystemClient.ACTION_START_INSTALL);
intent.putExtra(KEY_SYSTEM_URL, url);
intent.putExtra(KEY_SYSTEM_SIZE, systemSize);
intent.putExtra(KEY_USERDATA_SIZE, userdataSize);
diff --git a/services/art-profile b/services/art-profile
index 6368c63..f0b9234 100644
--- a/services/art-profile
+++ b/services/art-profile
@@ -1136,7 +1136,7 @@
Lcom/android/server/DropBoxManagerService$EntryFile;
Lcom/android/server/DropBoxManagerService$FileList;
Lcom/android/server/DropBoxManagerService;
-Lcom/android/server/DynamicAndroidService;
+Lcom/android/server/DynamicSystemService;
Lcom/android/server/EntropyMixer$1;
Lcom/android/server/EntropyMixer$2;
Lcom/android/server/EntropyMixer;
@@ -4769,9 +4769,9 @@
PLcom/android/server/DropBoxManagerService$EntryFile;->getFile(Ljava/io/File;)Ljava/io/File;
PLcom/android/server/DropBoxManagerService;->checkPermission(ILjava/lang/String;)Z
PLcom/android/server/DropBoxManagerService;->getNextEntry(Ljava/lang/String;JLjava/lang/String;)Landroid/os/DropBoxManager$Entry;
-PLcom/android/server/DynamicAndroidService;->connect(Landroid/os/IBinder$DeathRecipient;)Landroid/gsi/IGsiService;
-PLcom/android/server/DynamicAndroidService;->getGsiService()Landroid/gsi/IGsiService;
-PLcom/android/server/DynamicAndroidService;->isInUse()Z
+PLcom/android/server/DynamicSystemService;->connect(Landroid/os/IBinder$DeathRecipient;)Landroid/gsi/IGsiService;
+PLcom/android/server/DynamicSystemService;->getGsiService()Landroid/gsi/IGsiService;
+PLcom/android/server/DynamicSystemService;->isInUse()Z
PLcom/android/server/EntropyMixer$1;->handleMessage(Landroid/os/Message;)V
PLcom/android/server/EntropyMixer$2;->onReceive(Landroid/content/Context;Landroid/content/Intent;)V
PLcom/android/server/EventLogTags;->writeBatterySaverMode(IIIIILjava/lang/String;I)V
@@ -15043,7 +15043,7 @@
SPLcom/android/server/DropBoxManagerService;->onBootPhase(I)V
SPLcom/android/server/DropBoxManagerService;->onStart()V
SPLcom/android/server/DropBoxManagerService;->trimToFit()J
-SPLcom/android/server/DynamicAndroidService;-><init>(Landroid/content/Context;)V
+SPLcom/android/server/DynamicSystemService;-><init>(Landroid/content/Context;)V
SPLcom/android/server/EntropyMixer;-><init>(Landroid/content/Context;)V
SPLcom/android/server/EntropyMixer;-><init>(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
SPLcom/android/server/EntropyMixer;->addDeviceSpecificEntropy()V
diff --git a/services/core/java/com/android/server/DynamicAndroidService.java b/services/core/java/com/android/server/DynamicSystemService.java
similarity index 92%
rename from services/core/java/com/android/server/DynamicAndroidService.java
rename to services/core/java/com/android/server/DynamicSystemService.java
index b02bfb1..f5bd11c 100644
--- a/services/core/java/com/android/server/DynamicAndroidService.java
+++ b/services/core/java/com/android/server/DynamicSystemService.java
@@ -22,25 +22,25 @@
import android.gsi.IGsiService;
import android.os.IBinder;
import android.os.IBinder.DeathRecipient;
-import android.os.IDynamicAndroidService;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
+import android.os.image.IDynamicSystemService;
import android.util.Slog;
/**
- * DynamicAndroidService implements IDynamicAndroidService. It provides permission check before
+ * DynamicSystemService implements IDynamicSystemService. It provides permission check before
* passing requests to gsid
*/
-public class DynamicAndroidService extends IDynamicAndroidService.Stub implements DeathRecipient {
- private static final String TAG = "DynamicAndroidService";
+public class DynamicSystemService extends IDynamicSystemService.Stub implements DeathRecipient {
+ private static final String TAG = "DynamicSystemService";
private static final String NO_SERVICE_ERROR = "no gsiservice";
private static final int GSID_ROUGH_TIMEOUT_MS = 8192;
private Context mContext;
private volatile IGsiService mGsiService;
- DynamicAndroidService(Context context) {
+ DynamicSystemService(Context context) {
mContext = context;
}
@@ -93,9 +93,9 @@
private void checkPermission() {
if (mContext.checkCallingOrSelfPermission(
- android.Manifest.permission.MANAGE_DYNAMIC_ANDROID)
+ android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
!= PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires MANAGE_DYNAMIC_ANDROID permission");
+ throw new SecurityException("Requires MANAGE_DYNAMIC_SYSTEM permission");
}
}
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 419f52c..d4ccb0b 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -849,7 +849,7 @@
private void startOtherServices() {
final Context context = mSystemContext;
VibratorService vibrator = null;
- DynamicAndroidService dynamicAndroid = null;
+ DynamicSystemService dynamicSystem = null;
IStorageManager storageManager = null;
NetworkManagementService networkManagement = null;
IpSecService ipSecService = null;
@@ -968,9 +968,9 @@
ServiceManager.addService("vibrator", vibrator);
traceEnd();
- traceBeginAndSlog("StartDynamicAndroidService");
- dynamicAndroid = new DynamicAndroidService(context);
- ServiceManager.addService("dynamic_android", dynamicAndroid);
+ traceBeginAndSlog("StartDynamicSystemService");
+ dynamicSystem = new DynamicSystemService(context);
+ ServiceManager.addService("dynamic_system", dynamicSystem);
traceEnd();
if (!isWatch) {
diff --git a/services/tests/servicestests/src/com/android/server/DynamicAndroidServiceTest.java b/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
similarity index 68%
rename from services/tests/servicestests/src/com/android/server/DynamicAndroidServiceTest.java
rename to services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
index 1494284..4a9dd97 100644
--- a/services/tests/servicestests/src/com/android/server/DynamicAndroidServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
@@ -16,28 +16,28 @@
package com.android.server;
-import android.os.IDynamicAndroidService;
import android.os.ServiceManager;
+import android.os.image.IDynamicSystemService;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.LargeTest;
-public class DynamicAndroidServiceTest extends AndroidTestCase {
- private static final String TAG = "DynamicAndroidServiceTests";
- private IDynamicAndroidService mService;
+public class DynamicSystemServiceTest extends AndroidTestCase {
+ private static final String TAG = "DynamicSystemServiceTests";
+ private IDynamicSystemService mService;
@Override
protected void setUp() throws Exception {
mService =
- IDynamicAndroidService.Stub.asInterface(
- ServiceManager.getService("dynamic_android"));
+ IDynamicSystemService.Stub.asInterface(
+ ServiceManager.getService("dynamic_system"));
}
@LargeTest
public void test1() {
- assertTrue("dynamic_android service available", mService != null);
+ assertTrue("dynamic_system service available", mService != null);
try {
mService.startInstallation(1 << 20, 8 << 30);
- fail("DynamicAndroidService did not throw SecurityException as expected");
+ fail("DynamicSystemService did not throw SecurityException as expected");
} catch (SecurityException e) {
// expected
} catch (Exception e) {