Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2775c48d authored by Edward Cunningham's avatar Edward Cunningham Committed by Android (Google) Code Review
Browse files

Merge "Show indeterminate progess when installing." into sc-dev

parents f8dc7809 07fe8333
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -65,7 +65,8 @@
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingTop="8dp"
            style="?android:attr/progressBarStyleHorizontal" />
            style="?android:attr/progressBarStyleHorizontal"
            android:indeterminate="true" />

    </LinearLayout>

+0 −52
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;

import com.android.internal.app.AlertActivity;
import com.android.internal.content.PackageHelper;
@@ -61,9 +60,6 @@ public class InstallInstalling extends AlertActivity {
    private static final String BROADCAST_ACTION =
            "com.android.packageinstaller.ACTION_INSTALL_COMMIT";

    /** Listens to changed to the session and updates progress bar */
    private PackageInstaller.SessionCallback mSessionCallback;

    /** Task that sends the package to the package installer */
    private InstallingAsyncTask mInstallingTask;

@@ -185,8 +181,6 @@ public class InstallInstalling extends AlertActivity {
            }

            mCancelButton = mAlert.getButton(DialogInterface.BUTTON_NEGATIVE);

            mSessionCallback = new InstallSessionCallback();
        }
    }

@@ -221,13 +215,6 @@ public class InstallInstalling extends AlertActivity {
        finish();
    }

    @Override
    protected void onStart() {
        super.onStart();

        getPackageManager().getPackageInstaller().registerSessionCallback(mSessionCallback);
    }

    @Override
    protected void onResume() {
        super.onResume();
@@ -263,13 +250,6 @@ public class InstallInstalling extends AlertActivity {
        }
    }

    @Override
    protected void onStop() {
        super.onStop();

        getPackageManager().getPackageInstaller().unregisterSessionCallback(mSessionCallback);
    }

    @Override
    protected void onDestroy() {
        if (mInstallingTask != null) {
@@ -306,38 +286,6 @@ public class InstallInstalling extends AlertActivity {
        }
    }


    private class InstallSessionCallback extends PackageInstaller.SessionCallback {
        @Override
        public void onCreated(int sessionId) {
            // empty
        }

        @Override
        public void onBadgingChanged(int sessionId) {
            // empty
        }

        @Override
        public void onActiveChanged(int sessionId, boolean active) {
            // empty
        }

        @Override
        public void onProgressChanged(int sessionId, float progress) {
            if (sessionId == mSessionId) {
                ProgressBar progressBar = requireViewById(R.id.progress);
                progressBar.setMax(Integer.MAX_VALUE);
                progressBar.setProgress((int) (Integer.MAX_VALUE * progress));
            }
        }

        @Override
        public void onFinished(int sessionId, boolean success) {
            // empty, finish is handled by InstallResultReceiver
        }
    }

    /**
     * Send the package to the package installer and then register a event result observer that
     * will call {@link #launchFinishBasedOnResult(int, int, String)}