Revert "[pm/incremental] start monitoring progress on storage creation"
This reverts commit 31fa0fc9c1.
Reason for revert: Play data loader doesn't write data to incfs during "Downloading...", so we shouldn't use incfs progress to replace install progress. Reverting this, so that Launcher will display the install progress ring during "Downloading..." using the progress reported from Phonesky.
Change-Id: I124033d725fe488fd337b6ded0bdf319a764b6ca
BUG: 178528778
This commit is contained in:
@@ -36,7 +36,6 @@ import android.annotation.Nullable;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.DataLoaderParams;
|
import android.content.pm.DataLoaderParams;
|
||||||
import android.content.pm.IDataLoaderStatusListener;
|
import android.content.pm.IDataLoaderStatusListener;
|
||||||
import android.content.pm.IPackageLoadingProgressCallback;
|
|
||||||
import android.content.pm.InstallationFileParcel;
|
import android.content.pm.InstallationFileParcel;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
@@ -71,8 +70,7 @@ public final class IncrementalFileStorages {
|
|||||||
@Nullable StorageHealthCheckParams healthCheckParams,
|
@Nullable StorageHealthCheckParams healthCheckParams,
|
||||||
@Nullable IStorageHealthListener healthListener,
|
@Nullable IStorageHealthListener healthListener,
|
||||||
@NonNull List<InstallationFileParcel> addedFiles,
|
@NonNull List<InstallationFileParcel> addedFiles,
|
||||||
@NonNull PerUidReadTimeouts[] perUidReadTimeouts,
|
@NonNull PerUidReadTimeouts[] perUidReadTimeouts) throws IOException {
|
||||||
IPackageLoadingProgressCallback progressCallback) throws IOException {
|
|
||||||
// TODO(b/136132412): validity check if session should not be incremental
|
// TODO(b/136132412): validity check if session should not be incremental
|
||||||
IncrementalManager incrementalManager = (IncrementalManager) context.getSystemService(
|
IncrementalManager incrementalManager = (IncrementalManager) context.getSystemService(
|
||||||
Context.INCREMENTAL_SERVICE);
|
Context.INCREMENTAL_SERVICE);
|
||||||
@@ -97,11 +95,7 @@ public final class IncrementalFileStorages {
|
|||||||
throw new IOException("Unknown file location: " + file.location);
|
throw new IOException("Unknown file location: " + file.location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Register progress loading callback after files have been added
|
|
||||||
if (progressCallback != null) {
|
|
||||||
incrementalManager.registerLoadingProgressCallback(stageDir.getAbsolutePath(),
|
|
||||||
progressCallback);
|
|
||||||
}
|
|
||||||
result.startLoading();
|
result.startLoading();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -186,7 +180,6 @@ public final class IncrementalFileStorages {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
mDefaultStorage.unBind(mStageDir.getAbsolutePath());
|
mDefaultStorage.unBind(mStageDir.getAbsolutePath());
|
||||||
mDefaultStorage.unregisterLoadingProgressListener();
|
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
}
|
}
|
||||||
mDefaultStorage = null;
|
mDefaultStorage = null;
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ import android.content.pm.IDataLoaderStatusListener;
|
|||||||
import android.content.pm.IPackageInstallObserver2;
|
import android.content.pm.IPackageInstallObserver2;
|
||||||
import android.content.pm.IPackageInstallerSession;
|
import android.content.pm.IPackageInstallerSession;
|
||||||
import android.content.pm.IPackageInstallerSessionFileSystemConnector;
|
import android.content.pm.IPackageInstallerSessionFileSystemConnector;
|
||||||
import android.content.pm.IPackageLoadingProgressCallback;
|
|
||||||
import android.content.pm.InstallationFile;
|
import android.content.pm.InstallationFile;
|
||||||
import android.content.pm.InstallationFileParcel;
|
import android.content.pm.InstallationFileParcel;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
@@ -320,8 +319,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
private float mProgress = 0;
|
private float mProgress = 0;
|
||||||
@GuardedBy("mLock")
|
@GuardedBy("mLock")
|
||||||
private float mReportedProgress = -1;
|
private float mReportedProgress = -1;
|
||||||
@GuardedBy("mLock")
|
|
||||||
private float mIncrementalProgress = 0;
|
|
||||||
|
|
||||||
/** State of the session. */
|
/** State of the session. */
|
||||||
@GuardedBy("mLock")
|
@GuardedBy("mLock")
|
||||||
@@ -1185,12 +1182,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
|
|
||||||
@GuardedBy("mLock")
|
@GuardedBy("mLock")
|
||||||
private void computeProgressLocked(boolean forcePublish) {
|
private void computeProgressLocked(boolean forcePublish) {
|
||||||
// This method is triggered when the client progress is updated or the incremental progress
|
mProgress = MathUtils.constrain(mClientProgress * 0.8f, 0f, 0.8f)
|
||||||
// is updated. For incremental installs, ignore the progress values reported from client.
|
|
||||||
// Instead, only use the progress reported by IncFs as the percentage of loading completion.
|
|
||||||
final float loadingProgress =
|
|
||||||
isIncrementalInstallation() ? mIncrementalProgress : mClientProgress;
|
|
||||||
mProgress = MathUtils.constrain(loadingProgress * 0.8f, 0f, 0.8f)
|
|
||||||
+ MathUtils.constrain(mInternalProgress * 0.2f, 0f, 0.2f);
|
+ MathUtils.constrain(mInternalProgress * 0.2f, 0f, 0.2f);
|
||||||
|
|
||||||
// Only publish when meaningful change
|
// Only publish when meaningful change
|
||||||
@@ -3712,16 +3704,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
try {
|
try {
|
||||||
mIncrementalFileStorages = IncrementalFileStorages.initialize(mContext, stageDir,
|
mIncrementalFileStorages = IncrementalFileStorages.initialize(mContext, stageDir,
|
||||||
params, statusListener, healthCheckParams, healthListener, addedFiles,
|
params, statusListener, healthCheckParams, healthListener, addedFiles,
|
||||||
perUidReadTimeouts,
|
perUidReadTimeouts);
|
||||||
new IPackageLoadingProgressCallback.Stub() {
|
|
||||||
@Override
|
|
||||||
public void onPackageLoadingProgressChanged(float progress) {
|
|
||||||
synchronized (mLock) {
|
|
||||||
mIncrementalProgress = progress;
|
|
||||||
computeProgressLocked(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
return false;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new PackageManagerException(INSTALL_FAILED_MEDIA_UNAVAILABLE, e.getMessage(),
|
throw new PackageManagerException(INSTALL_FAILED_MEDIA_UNAVAILABLE, e.getMessage(),
|
||||||
|
|||||||
Reference in New Issue
Block a user