summaryrefslogtreecommitdiffstats
path: root/updater_sample/src/com/example/android/systemupdatersample/ui/MainActivity.java
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-06-01 11:31:14 +0200
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-06-01 11:31:14 +0200
commit6611560b8c828874738e537a4e1f787fc34db783 (patch)
tree863032ef175cf97c713f7cb16d2a3d8efe38c654 /updater_sample/src/com/example/android/systemupdatersample/ui/MainActivity.java
parentSnap for 4806815 from e76ed816b94f1e89be3f965152ea83dd48f67b51 to qt-release (diff)
parentMerge "recovery: add --fsck_unshare_blocks option for adb remount" am: bda4495176 am: b0d9b3594b (diff)
downloadandroid_bootable_recovery-6611560b8c828874738e537a4e1f787fc34db783.tar
android_bootable_recovery-6611560b8c828874738e537a4e1f787fc34db783.tar.gz
android_bootable_recovery-6611560b8c828874738e537a4e1f787fc34db783.tar.bz2
android_bootable_recovery-6611560b8c828874738e537a4e1f787fc34db783.tar.lz
android_bootable_recovery-6611560b8c828874738e537a4e1f787fc34db783.tar.xz
android_bootable_recovery-6611560b8c828874738e537a4e1f787fc34db783.tar.zst
android_bootable_recovery-6611560b8c828874738e537a4e1f787fc34db783.zip
Diffstat (limited to 'updater_sample/src/com/example/android/systemupdatersample/ui/MainActivity.java')
-rw-r--r--updater_sample/src/com/example/android/systemupdatersample/ui/MainActivity.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/updater_sample/src/com/example/android/systemupdatersample/ui/MainActivity.java b/updater_sample/src/com/example/android/systemupdatersample/ui/MainActivity.java
index 9983fe316..1de72c2d6 100644
--- a/updater_sample/src/com/example/android/systemupdatersample/ui/MainActivity.java
+++ b/updater_sample/src/com/example/android/systemupdatersample/ui/MainActivity.java
@@ -33,11 +33,11 @@ import android.widget.TextView;
import com.example.android.systemupdatersample.R;
import com.example.android.systemupdatersample.UpdateConfig;
import com.example.android.systemupdatersample.UpdateManager;
+import com.example.android.systemupdatersample.UpdaterState;
import com.example.android.systemupdatersample.util.PayloadSpecs;
import com.example.android.systemupdatersample.util.UpdateConfigs;
import com.example.android.systemupdatersample.util.UpdateEngineErrorCodes;
import com.example.android.systemupdatersample.util.UpdateEngineStatuses;
-import com.example.android.systemupdatersample.util.UpdaterStates;
import java.util.List;
@@ -108,12 +108,16 @@ public class MainActivity extends Activity {
@Override
protected void onResume() {
super.onResume();
+ // TODO(zhomart) load saved states
+ // Binding to UpdateEngine invokes onStatusUpdate callback,
+ // persisted updater state has to be loaded and prepared beforehand.
this.mUpdateManager.bind();
}
@Override
protected void onPause() {
this.mUpdateManager.unbind();
+ // TODO(zhomart) save state
super.onPause();
}
@@ -192,7 +196,7 @@ public class MainActivity extends Activity {
/**
* Invoked when SystemUpdaterSample app state changes.
* Value of {@code state} will be one of the
- * values from {@link UpdaterStates}.
+ * values from {@link UpdaterState}.
*/
private void onUpdaterStateChange(int state) {
Log.i(TAG, "onUpdaterStateChange invoked state=" + state);
@@ -233,8 +237,8 @@ public class MainActivity extends Activity {
runOnUiThread(() -> {
Log.i(TAG,
"Completed - errorCode="
- + UpdateEngineErrorCodes.getCodeName(errorCode) + "/" + errorCode
- + " " + completionState);
+ + UpdateEngineErrorCodes.getCodeName(errorCode) + "/" + errorCode
+ + " " + completionState);
setUiEngineErrorCode(errorCode);
if (errorCode == UpdateEngineErrorCodes.UPDATED_BUT_NOT_ACTIVE) {
// if update was successfully applied.
@@ -323,7 +327,7 @@ public class MainActivity extends Activity {
* @param state updater sample state
*/
private void setUiUpdaterState(int state) {
- String stateText = UpdaterStates.getStateText(state);
+ String stateText = UpdaterState.getStateText(state);
mTextViewUpdaterState.setText(stateText + "/" + state);
}