Better status update
Keyguard prompt is part of the installation flow.
We should post a status update to notify the caller if
the keyguard is dismissed and installation won't continue.
Bug: 277691885
Test: 1. set up lock screen password
2. kick off DSU installation
3. press back key to dismiss keyguard
4. check logcat messages and find
"DynamicSystemInstallationService: status: NOT_STARTED, cause: INSTALL_CANCELLED"
Change-Id: I0c919841d756ada6e94414e58f310635e4d8c12c
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user