Commit 93682c92 authored by Kenji Bungo's avatar Kenji Bungo
Browse files

Firmware Update Success now uses a notification. Failure still uses dialog....

Firmware Update Success now uses a notification. Failure still uses dialog. Either can be toggled with a static flag.
parent 8bb8c1fe
res/drawable-hdpi/update_error.png

458 Bytes

res/drawable-hdpi/update_success.png

481 Bytes

res/drawable-ldpi/update_error.png

458 Bytes

res/drawable-ldpi/update_success.png

481 Bytes

res/drawable-mdpi/update_error.png

458 Bytes

res/drawable-mdpi/update_success.png

481 Bytes

......@@ -16,6 +16,8 @@ import java.util.Locale;
import android.annotation.TargetApi;
import android.app.Service;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
......@@ -30,6 +32,7 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.UserHandle;
import android.os.Build;
import android.util.Log;
import android.widget.Toast;
import android.os.SystemProperties;
......@@ -40,7 +43,6 @@ public class RKUpdateService extends Service {
public static final String VERSION = "1.8.0";
private static final String TAG = "RKUpdateService";
private static final boolean DEBUG = false;
private static final boolean mIsNotifyDialog = true;
private static final boolean mIsSupportUsbUpdate = false;
private static File RECOVERY_DIR = new File("/cache/recovery");
......@@ -90,6 +92,10 @@ public class RKUpdateService extends Service {
public static final int UPDATE_SUCCESS = 1;
public static final int UPDATE_FAILED = 2;
private static final boolean SUCCESS_USE_DIALOG = false;
private static final boolean FAILURE_USE_DIALOG = true;
private static final int COMPLETE_NOTIF_ID = 100;
private static final String[] IMAGE_FILE_DIRS = {
DATA_ROOT + "/",
......@@ -230,9 +236,15 @@ public class RKUpdateService extends Service {
if(command.startsWith(COMMAND_FLAG_SUCCESS)) {
if(!mIsNotifyDialog) {
if(!SUCCESS_USE_DIALOG) {
mIsNeedDeletePackage = true;
mLastUpdatePath = path;
Notification.Builder nBuilder = new Notification.Builder(this);
nBuilder.setContentTitle("Firmware Update Success");
nBuilder.setSmallIcon(R.drawable.update_success);
nBuilder.setContentText(Build.DISPLAY);
getSystemService(NotificationManager.class).notify(COMPLETE_NOTIF_ID, nBuilder.build());
return;
}
......@@ -246,6 +258,17 @@ public class RKUpdateService extends Service {
return;
}
if(command.startsWith(COMMAND_FLAG_UPDATING)) {
if(!FAILURE_USE_DIALOG) {
mIsNeedDeletePackage = true;
mLastUpdatePath = path;
Notification.Builder nBuilder = new Notification.Builder(this);
nBuilder.setContentTitle("Firmware Update Failure");
nBuilder.setSmallIcon(R.drawable.update_error);
nBuilder.setContentText("Validate file and try again.");
getSystemService(NotificationManager.class).notify(COMPLETE_NOTIF_ID, nBuilder.build());
return;
}
Intent intent = new Intent(mContext, NotifyDeleteActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("flag", UPDATE_FAILED);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment