Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Removed reboot action from restart required notification
Browse files Browse the repository at this point in the history
because is does not and can not work in all situations
and because I do not want to answer questions about this each time
this feature is also not relevant to privacy

Refs #1485
  • Loading branch information
M66B committed Mar 6, 2014
1 parent 7c0b585 commit fbc2e82
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 62 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Changelog

**Next release**

* Removed reboot action from restart required notification ([issue](/../../issues/1485))
* Updated Slovenian translation

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)
Expand Down
41 changes: 0 additions & 41 deletions src/biz/bokhorst/xprivacy/ActivityMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ public class ActivityMain extends ActivityBase implements OnItemSelectedListener

private Handler mProHandler = new Handler();

public static final String cAction = "Action";
public static final int cActionReboot = 1;

public static final int STATE_ATTENTION = 0;
public static final int STATE_CHANGED = 1;
public static final int STATE_SHARED = 2;
Expand Down Expand Up @@ -160,12 +157,6 @@ public void onReceive(Context context, Intent intent) {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Process reboot action
Bundle extras = getIntent().getExtras();
if (extras != null && extras.containsKey(cAction))
if (extras.getInt(cAction) == cActionReboot)
reboot();

// Check privacy service client
if (!PrivacyService.checkClient())
return;
Expand Down Expand Up @@ -309,14 +300,6 @@ protected void onResume() {

@Override
protected void onNewIntent(Intent intent) {
Bundle extras = intent.getExtras();
if (extras != null && extras.containsKey(cAction))
if (extras.getInt(cAction) == cActionReboot) {
setIntent(intent);
recreate();
return;
}

if (mAppAdapter != null)
mAppAdapter.notifyDataSetChanged();
}
Expand Down Expand Up @@ -1001,30 +984,6 @@ private void optionTutorial() {
PrivacyManager.setSetting(0, PrivacyManager.cSettingTutorialMain, Boolean.FALSE.toString());
}

private void reboot() {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ActivityMain.this);
alertDialogBuilder.setTitle(R.string.msg_reboot);
alertDialogBuilder.setMessage(R.string.msg_sure);
alertDialogBuilder.setIcon(getThemed(R.attr.icon_launcher));
alertDialogBuilder.setPositiveButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
try {
PrivacyService.getClient().reboot();
} catch (Throwable ex) {
Util.bug(null, ex);
}
}
});
alertDialogBuilder.setNegativeButton(getString(android.R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}

// Tasks

private class AppListTask extends AsyncTask<Object, Integer, List<ApplicationInfoEx>> {
Expand Down
1 change: 0 additions & 1 deletion src/biz/bokhorst/xprivacy/IPrivacyService.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ interface IPrivacyService {
void deleteSettings(int uid);

void clear();
void reboot();
void dump(int uid);
}
8 changes: 0 additions & 8 deletions src/biz/bokhorst/xprivacy/PackageChange.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,11 @@ public void onReceive(final Context context, Intent intent) {
changeIntent.putExtra(UpdateService.cAction, UpdateService.cActionUpdated);
context.startService(changeIntent);

Intent resultIntent = new Intent(context, ActivityMain.class);
resultIntent.putExtra(ActivityMain.cAction, ActivityMain.cActionReboot);

// Build pending intent
PendingIntent pendingIntent = PendingIntent.getActivity(context, uid, resultIntent,
PendingIntent.FLAG_UPDATE_CURRENT);

// Build notification
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context);
notificationBuilder.setSmallIcon(R.drawable.ic_launcher);
notificationBuilder.setContentTitle(context.getString(R.string.app_name));
notificationBuilder.setContentText(context.getString(R.string.msg_reboot));
notificationBuilder.setContentIntent(pendingIntent);
notificationBuilder.setWhen(System.currentTimeMillis());
notificationBuilder.setAutoCancel(true);
Notification notification = notificationBuilder.build();
Expand Down
12 changes: 0 additions & 12 deletions src/biz/bokhorst/xprivacy/PrivacyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.PowerManager;
import android.os.Process;
import android.os.RemoteException;
import android.os.StrictMode;
Expand Down Expand Up @@ -1178,17 +1177,6 @@ public void clear() throws RemoteException {
}
}

@Override
public void reboot() throws RemoteException {
try {
enforcePermission();
Binder.clearCallingIdentity();
((PowerManager) getContext().getSystemService(Context.POWER_SERVICE)).reboot(null);
} catch (Throwable ex) {
Util.bug(null, ex);
}
}

@Override
public void dump(int uid) throws RemoteException {
if (uid == 0) {
Expand Down

0 comments on commit fbc2e82

Please sign in to comment.