Loading core/java/android/content/pm/IOtaDexopt.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,12 @@ interface IOtaDexopt { */ boolean isDone(); /** * Return the progress (0..1) made in this session. When {@link #isDone() isDone} returns * true, the progress value will be 1. */ float getProgress(); /** * Optimize the next package. Note: this command is synchronous, that is, only returns after * the package has been dexopted (or dexopting failed). Loading services/core/java/com/android/server/pm/OtaDexoptService.java +10 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ public class OtaDexoptService extends IOtaDexopt.Stub { // TODO: Evaluate the need for WeakReferences here. private List<PackageParser.Package> mDexoptPackages; private int completeSize; public OtaDexoptService(Context context, PackageManagerService packageManagerService) { this.mContext = context; Loading Loading @@ -91,6 +92,7 @@ public class OtaDexoptService extends IOtaDexopt.Stub { mDexoptPackages = PackageManagerServiceUtils.getPackagesForDexopt( mPackageManagerService.mPackages.values(), mPackageManagerService); } completeSize = mDexoptPackages.size(); } @Override Loading @@ -110,6 +112,14 @@ public class OtaDexoptService extends IOtaDexopt.Stub { return mDexoptPackages.isEmpty(); } @Override public synchronized float getProgress() throws RemoteException { if (completeSize == 0) { return 1f; } return (completeSize - mDexoptPackages.size()) / ((float)completeSize); } @Override public synchronized void dexoptNextPackage() throws RemoteException { if (mDexoptPackages == null) { Loading services/core/java/com/android/server/pm/OtaDexoptShellCommand.java +9 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ class OtaDexoptShellCommand extends ShellCommand { return runOtaDone(); case "step": return runOtaStep(); case "progress": return runOtaProgress(); default: return handleDefaultCommands(cmd); } Loading Loading @@ -81,6 +83,13 @@ class OtaDexoptShellCommand extends ShellCommand { return 0; } private int runOtaProgress() throws RemoteException { final float progress = mInterface.getProgress(); final PrintWriter pw = getOutPrintWriter(); pw.format("%.2f", progress); return 0; } @Override public void onHelp() { final PrintWriter pw = getOutPrintWriter(); Loading Loading
core/java/android/content/pm/IOtaDexopt.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,12 @@ interface IOtaDexopt { */ boolean isDone(); /** * Return the progress (0..1) made in this session. When {@link #isDone() isDone} returns * true, the progress value will be 1. */ float getProgress(); /** * Optimize the next package. Note: this command is synchronous, that is, only returns after * the package has been dexopted (or dexopting failed). Loading
services/core/java/com/android/server/pm/OtaDexoptService.java +10 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ public class OtaDexoptService extends IOtaDexopt.Stub { // TODO: Evaluate the need for WeakReferences here. private List<PackageParser.Package> mDexoptPackages; private int completeSize; public OtaDexoptService(Context context, PackageManagerService packageManagerService) { this.mContext = context; Loading Loading @@ -91,6 +92,7 @@ public class OtaDexoptService extends IOtaDexopt.Stub { mDexoptPackages = PackageManagerServiceUtils.getPackagesForDexopt( mPackageManagerService.mPackages.values(), mPackageManagerService); } completeSize = mDexoptPackages.size(); } @Override Loading @@ -110,6 +112,14 @@ public class OtaDexoptService extends IOtaDexopt.Stub { return mDexoptPackages.isEmpty(); } @Override public synchronized float getProgress() throws RemoteException { if (completeSize == 0) { return 1f; } return (completeSize - mDexoptPackages.size()) / ((float)completeSize); } @Override public synchronized void dexoptNextPackage() throws RemoteException { if (mDexoptPackages == null) { Loading
services/core/java/com/android/server/pm/OtaDexoptShellCommand.java +9 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ class OtaDexoptShellCommand extends ShellCommand { return runOtaDone(); case "step": return runOtaStep(); case "progress": return runOtaProgress(); default: return handleDefaultCommands(cmd); } Loading Loading @@ -81,6 +83,13 @@ class OtaDexoptShellCommand extends ShellCommand { return 0; } private int runOtaProgress() throws RemoteException { final float progress = mInterface.getProgress(); final PrintWriter pw = getOutPrintWriter(); pw.format("%.2f", progress); return 0; } @Override public void onHelp() { final PrintWriter pw = getOutPrintWriter(); Loading