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

Commit ddaa0255 authored by Chun-Wei Wang's avatar Chun-Wei Wang Committed by Automerger Merge Worker
Browse files

Merge "Better status update" am: 7eeb66f2 am: df98ac29

parents 9deb015e df98ac29
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -209,6 +209,13 @@ public class DynamicSystemClient {
    public static final String ACTION_HIDE_NOTIFICATION =
            "android.os.image.action.HIDE_NOTIFICATION";

    /**
     * Intent action: notify the service to post a status update when keyguard is dismissed.
     * @hide
     */
    public static final String ACTION_NOTIFY_KEYGUARD_DISMISSED =
            "android.os.image.action.NOTIFY_KEYGUARD_DISMISSED";

    /*
     * Intent Keys
     */
+7 −2
Original line number Diff line number Diff line
@@ -16,11 +16,10 @@

package com.android.dynsystem;

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_HIDE_NOTIFICATION;
import static android.os.image.DynamicSystemClient.ACTION_NOTIFY_IF_IN_USE;
import static android.os.image.DynamicSystemClient.ACTION_NOTIFY_KEYGUARD_DISMISSED;
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;
@@ -234,6 +233,8 @@ public class DynamicSystemInstallationService extends Service
            executeNotifyIfInUseCommand();
        } else if (ACTION_HIDE_NOTIFICATION.equals(action)) {
            executeHideNotificationCommand();
        } else if (ACTION_NOTIFY_KEYGUARD_DISMISSED.equals(action)) {
            executeNotifyKeyguardDismissed();
        }

        return Service.START_NOT_STICKY;
@@ -477,6 +478,10 @@ public class DynamicSystemInstallationService extends Service
        }
    }

    private void executeNotifyKeyguardDismissed() {
        postStatus(STATUS_NOT_STARTED, CAUSE_INSTALL_CANCELLED, null);
    }

    private void resetTaskAndStop() {
        resetTaskAndStop(/* removeNotification= */ false);
    }
+9 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.dynsystem;

import static android.os.image.DynamicSystemClient.ACTION_NOTIFY_KEYGUARD_DISMISSED;
import static android.os.image.DynamicSystemClient.KEY_KEYGUARD_USE_DEFAULT_STRINGS;

import android.app.Activity;
@@ -83,11 +84,19 @@ public class VerificationActivity extends Activity {
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
            startInstallationService();
        } else {
            notifyKeyguardDismissed();
        }

        finish();
    }

    private void notifyKeyguardDismissed() {
        Intent intent = new Intent(this, DynamicSystemInstallationService.class);
        intent.setAction(ACTION_NOTIFY_KEYGUARD_DISMISSED);
        startServiceAsUser(intent, UserHandle.SYSTEM);
    }

    private void startInstallationService() {
        // retrieve data from calling intent
        Intent callingIntent = getIntent();