Remove Auto Root Code

Revert this commit after things are sorted out
This commit is contained in:
topjohnwu 2016-09-30 18:07:08 +08:00
parent 21504f1329
commit eebd64bedb
47 changed files with 68 additions and 1469 deletions

View File

@ -32,14 +32,13 @@ repositories {
dependencies { dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs') compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:recyclerview-v7:24.2.1' compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1' compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:design:24.2.1' compile 'com.android.support:design:24.2.1'
compile 'com.github.d8ahazard:BroadcastTileSupportUpdate:master'
compile 'com.getkeepsafe.taptargetview:taptargetview:1.2.0'
compile 'com.jakewharton:butterknife:8.4.0' compile 'com.jakewharton:butterknife:8.4.0'
compile 'com.github.michalis-vitos:aFileChooser:master' compile 'com.github.michalis-vitos:aFileChooser:master'
compile 'com.google.code.gson:gson:2.7' compile 'com.google.code.gson:gson:2.7'
compile 'com.android.support:support-v4:24.2.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0' annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
} }

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="com.topjohnwu.magisk"> package="com.topjohnwu.magisk">
<uses-sdk tools:overrideLibrary="com.kcoppock.broadcatsttilesupport" /> <uses-sdk tools:overrideLibrary="com.kcoppock.broadcatsttilesupport" />
@ -15,62 +14,24 @@
tools:ignore="ProtectedPermissions" /> tools:ignore="ProtectedPermissions" />
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning"> tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<service
android:name=".services.MonitorService"
android:label="@string/app_name"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
<meta-data
android:name="android.accessibilityservice"
android:resource="@xml/accessibilityservice" />
</service>
<service
android:name=".services.TileServiceNewApi"
android:icon="@drawable/ic_autoroot"
android:label="@string/app_name"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>
<service
android:name=".services.TileServiceCompat"
android:enabled="true"
android:exported="true" />
<receiver
android:name=".receivers.PrivateBroadcastReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.topjohnwu.magisk.CUSTOMTILE_ACTION_AUTOROOT" />
<action android:name="com.topjohnwu.magisk.CUSTOMTILE_ACTION_DISABLEROOT" />
<action android:name="com.topjohnwu.magisk.CUSTOMTILE_ACTION_ENABLEROOT" />
</intent-filter>
</receiver>
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:exported="true"> android:exported="true"/>
</activity>
<activity <activity
android:name=".SplashActivity" android:name=".SplashActivity"
android:theme="@style/SplashTheme"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:exported="true"> android:exported="true"
android:theme="@style/SplashTheme">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
@ -101,6 +62,7 @@
<action android:name="android.content.action.DOCUMENTS_PROVIDER" /> <action android:name="android.content.action.DOCUMENTS_PROVIDER" />
</intent-filter> </intent-filter>
</provider> </provider>
<activity <activity
android:name=".AboutActivity" android:name=".AboutActivity"
android:theme="@style/AppTheme.Transparent" /> android:theme="@style/AppTheme.Transparent" />
@ -114,14 +76,7 @@
android:name="android.support.FILE_PROVIDER_PATHS" android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" /> android:resource="@xml/file_paths" />
</provider> </provider>
<receiver android:name=".receivers.AutoStartReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
</application> </application>
</manifest> </manifest>

View File

@ -26,7 +26,7 @@ import java.io.InputStream;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
public class AboutActivity extends AppCompatActivity { public class AboutActivity extends AppCompatActivity {
private static final String SOURCE_CODE_URL = "https://github.com/topjohnwu/MagiskManager"; private static final String SOURCE_CODE_URL = "https://github.com/topjohnwu/MagiskManager";
private static final String XDA_THREAD = "http://forum.xda-developers.com/showthread.php?t=3432382"; private static final String XDA_THREAD = "http://forum.xda-developers.com/showthread.php?t=3432382";

View File

@ -1,172 +0,0 @@
package com.topjohnwu.magisk;
import android.app.ListFragment;
import android.app.ProgressDialog;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import com.topjohnwu.magisk.utils.ApplicationAdapter;
import com.topjohnwu.magisk.utils.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class AutoRootFragment extends ListFragment {
private PackageManager packageManager = null;
private List<ApplicationInfo> applist = null;
private ApplicationAdapter listadaptor = null;
public ListView listView;
public SharedPreferences prefs;
List<String> arrayBlackList;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
View view = inflater.inflate(R.layout.auto_root_fragment, container, false);
int horizontalMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics());
int verticalMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics());
TypedValue tv = new TypedValue();
int actionBarHeight = 130;
if (getActivity().getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics());
}
view.setPadding(horizontalMargin, actionBarHeight, horizontalMargin, verticalMargin);
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
@Override
public void onResume() {
super.onResume();
initializeElements();
super.onResume();
getActivity().setTitle(R.string.auto_toggle);
}
private void initializeElements() {
listView = getListView();
packageManager = getActivity().getPackageManager();
new LoadApplications().execute();
}
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
Logger.dev("Click");
super.onListItemClick(l, v, position, id);
ApplicationInfo app = applist.get(position);
ToggleApp(app.packageName, position, v);
}
private void ToggleApp(String appToCheck, int position, View v) {
Logger.dev("Magisk", "AutoRootFragment: ToggleApp called for " + appToCheck);
Set<String> blackListSet = prefs.getStringSet("auto_blacklist", null);
assert blackListSet != null;
arrayBlackList = new ArrayList<>(blackListSet);
if (!arrayBlackList.contains(appToCheck)) {
arrayBlackList.add(appToCheck);
} else {
for (int i = 0; i < arrayBlackList.size(); i++) {
if (appToCheck.equals(arrayBlackList.get(i))) {
arrayBlackList.remove(i);
}
}
}
Logger.dev("Committing set, value is: " + arrayBlackList.toString());
SharedPreferences.Editor editor = prefs.edit();
editor.putStringSet("auto_blacklist", new HashSet<>(arrayBlackList));
editor.apply();
listadaptor.UpdateRootStatusView(position, v);
}
private List<ApplicationInfo> checkForLaunchIntent(List<ApplicationInfo> list) {
ArrayList<ApplicationInfo> applist = new ArrayList<>();
for (ApplicationInfo info : list) {
try {
if (null != packageManager.getLaunchIntentForPackage(info.packageName)) {
if (!info.packageName.contains("magisk")) {
applist.add(info);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
Collections.sort(applist, new CustomComparator());
return applist;
}
public class CustomComparator implements Comparator<ApplicationInfo> {
@Override
public int compare(ApplicationInfo o1, ApplicationInfo o2) {
return o1.loadLabel(packageManager).toString().compareToIgnoreCase(o2.loadLabel(packageManager).toString());
}
}
private class LoadApplications extends AsyncTask<Void, Void, Void> {
private ProgressDialog progress = null;
@Override
protected Void doInBackground(Void... params) {
applist = checkForLaunchIntent(packageManager.getInstalledApplications(PackageManager.GET_META_DATA));
listadaptor = new ApplicationAdapter(getActivity(),
R.layout.list_item_app, applist);
return null;
}
@Override
protected void onCancelled() {
super.onCancelled();
}
@Override
protected void onPostExecute(Void result) {
setListAdapter(listadaptor);
progress.dismiss();
super.onPostExecute(result);
}
@Override
protected void onPreExecute() {
progress = ProgressDialog.show(getActivity(), null,
"Loading application info...");
super.onPreExecute();
}
@Override
protected void onProgressUpdate(Void... values) {
super.onProgressUpdate(values);
}
}
}

View File

@ -150,11 +150,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
tag = "root"; tag = "root";
navFragment = new RootFragment(); navFragment = new RootFragment();
break; break;
case R.id.autoroot:
setTitle(R.string.auto_toggle);
tag = "autoroot";
navFragment = new AutoRootFragment();
break;
case R.id.modules: case R.id.modules:
setTitle(R.string.modules); setTitle(R.string.modules);
tag = "modules"; tag = "modules";

View File

@ -22,7 +22,6 @@ import android.widget.Switch;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.topjohnwu.magisk.services.MonitorService;
import com.topjohnwu.magisk.utils.Logger; import com.topjohnwu.magisk.utils.Logger;
import com.topjohnwu.magisk.utils.Shell; import com.topjohnwu.magisk.utils.Shell;
import com.topjohnwu.magisk.utils.Utils; import com.topjohnwu.magisk.utils.Utils;
@ -39,13 +38,11 @@ public class RootFragment extends Fragment {
@BindView(R.id.progressBar) ProgressBar progressBar; @BindView(R.id.progressBar) ProgressBar progressBar;
@BindView(R.id.rootSwitchView) View rootToggleView; @BindView(R.id.rootSwitchView) View rootToggleView;
@BindView(R.id.autoRootSwitchView) View autoRootToggleView;
@BindView(R.id.selinuxSwitchView) View selinuxToggleView; @BindView(R.id.selinuxSwitchView) View selinuxToggleView;
@BindView(R.id.rootStatusView) View rootStatusView; @BindView(R.id.rootStatusView) View rootStatusView;
@BindView(R.id.safetynetStatusView) View safetynetStatusView; @BindView(R.id.safetynetStatusView) View safetynetStatusView;
@BindView(R.id.selinuxStatusView) View selinuxStatusView; @BindView(R.id.selinuxStatusView) View selinuxStatusView;
@BindView(R.id.root_toggle) Switch rootToggle; @BindView(R.id.root_toggle) Switch rootToggle;
@BindView(R.id.auto_root_toggle) Switch autoRootToggle;
@BindView(R.id.selinux_toggle) Switch selinuxToggle; @BindView(R.id.selinux_toggle) Switch selinuxToggle;
@BindView(R.id.root_status_container) View rootStatusContainer; @BindView(R.id.root_status_container) View rootStatusContainer;
@BindView(R.id.root_status_icon) ImageView rootStatusIcon; @BindView(R.id.root_status_icon) ImageView rootStatusIcon;
@ -57,19 +54,17 @@ public class RootFragment extends Fragment {
@BindView(R.id.safety_net_icon) ImageView safetyNetStatusIcon; @BindView(R.id.safety_net_icon) ImageView safetyNetStatusIcon;
int statusOK = R.drawable.ic_check_circle; int statusOK = R.drawable.ic_check_circle;
int statusAuto = R.drawable.ic_autoroot;
int statusError = R.drawable.ic_error; int statusError = R.drawable.ic_error;
int statusUnknown = R.drawable.ic_help; int statusUnknown = R.drawable.ic_help;
private int colorOK, colorFail, colorNeutral, colorWarn; private int colorOK, colorFail, colorNeutral, colorWarn;
private boolean autoRootStatus; //private boolean autoRootStatus;
private SharedPreferences.OnSharedPreferenceChangeListener listener; private SharedPreferences.OnSharedPreferenceChangeListener listener;
private View view;
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.root_fragment, container, false); View view = inflater.inflate(R.layout.root_fragment, container, false);
ButterKnife.bind(this, view); ButterKnife.bind(this, view);
int[] attrs0 = {R.attr.ColorOK}; int[] attrs0 = {R.attr.ColorOK};
int[] attrs1 = {R.attr.ColorFail}; int[] attrs1 = {R.attr.ColorFail};
@ -87,17 +82,9 @@ public class RootFragment extends Fragment {
ta1.recycle(); ta1.recycle();
ta2.recycle(); ta2.recycle();
ta3.recycle(); ta3.recycle();
autoRootStatus = Utils.autoToggleEnabled(getActivity());
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
if (autoRootStatus) {
if (!Utils.hasServicePermission(getActivity())) {
autoRootStatus = false;
}
}
rootToggle.setEnabled(!autoRootStatus);
autoRootToggle.setChecked(autoRootStatus);
updateUI(); updateUI();
rootToggle.setOnClickListener(toggle -> { rootToggle.setOnClickListener(toggle -> {
@ -111,19 +98,6 @@ public class RootFragment extends Fragment {
}); });
autoRootToggle.setOnClickListener(toggle -> {
if (!Utils.hasServicePermission(getActivity())) {
Intent intent = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS);
Toast.makeText(getActivity(), "Please enable accessibility access for Magisk's auto-toggle feature to work.", Toast.LENGTH_LONG).show();
startActivityForResult(intent, 100);
} else {
toggleAutoRoot(autoRootToggle.isChecked());
}
}
);
selinuxToggle.setOnClickListener(toggle -> { selinuxToggle.setOnClickListener(toggle -> {
new AsyncTask<Boolean, Void, Void>() { new AsyncTask<Boolean, Void, Void>() {
@ -148,10 +122,8 @@ public class RootFragment extends Fragment {
super.onResume(); super.onResume();
getActivity().setTitle(R.string.root); getActivity().setTitle(R.string.root);
listener = (pref, key) -> { listener = (pref, key) -> {
if ((key.contains("autoRootEnable")) || (key.equals("root"))) { if ((key.contains("autoRootEnable")) || (key.equals("root"))) {
Logger.dev("RootFragmnet, keychange detected for " + key); Logger.dev("RootFragmnet, keychange detected for " + key);
//new updateUI().execute();
updateUI(); updateUI();
} }
@ -166,45 +138,7 @@ public class RootFragment extends Fragment {
prefs.unregisterOnSharedPreferenceChangeListener(listener); prefs.unregisterOnSharedPreferenceChangeListener(listener);
} }
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// Check which request we're responding to
Log.d("Magisk", "Got result: " + requestCode + " and " + resultCode);
if (requestCode == 100) {
if (Utils.hasServicePermission(getActivity())) {
toggleAutoRoot(true);
Snackbar.make(view, getActivity().getString(R.string.auto_toggle) + " has been enabled.", Snackbar.LENGTH_LONG).show();
} else {
autoRootToggle.setChecked(false);
Snackbar.make(view, getActivity().getString(R.string.auto_toggle) + " disabled, permissions required.", Snackbar.LENGTH_LONG).show();
}
}
}
private void toggleAutoRoot(boolean toggleState) {
autoRootStatus = toggleState;
Utils.toggleAutoRoot(toggleState, getActivity());
if (toggleState) {
Intent myIntent = new Intent(getActivity(), MonitorService.class);
getActivity().startService(myIntent);
rootToggle.setEnabled(false);
boolean boo = Utils.isMyServiceRunning(MonitorService.class, getActivity());
if (boo) {
Intent myServiceIntent = new Intent(getActivity(), MonitorService.class);
getActivity().startService(myServiceIntent);
}
} else {
Intent myIntent = new Intent(getActivity(), MonitorService.class);
getActivity().stopService(myIntent);
rootToggle.setEnabled(true);
}
}
private void updateUI() { private void updateUI() {
autoRootToggle.setChecked(autoRootStatus);
progressBar.setVisibility(View.GONE); progressBar.setVisibility(View.GONE);
rootStatusView.setVisibility(View.VISIBLE); rootStatusView.setVisibility(View.VISIBLE);
safetynetStatusView.setVisibility(View.VISIBLE); safetynetStatusView.setVisibility(View.VISIBLE);
@ -212,7 +146,6 @@ public class RootFragment extends Fragment {
if (Shell.rootAccess()) { if (Shell.rootAccess()) {
rootToggleView.setVisibility(View.VISIBLE); rootToggleView.setVisibility(View.VISIBLE);
autoRootToggleView.setVisibility(View.VISIBLE);
selinuxToggleView.setVisibility(View.VISIBLE); selinuxToggleView.setVisibility(View.VISIBLE);
} }
@ -268,40 +201,27 @@ public class RootFragment extends Fragment {
break; break;
case 1: case 1:
// Proper root // Proper root
if (autoRootStatus) { rootToggle.setEnabled(true);
rootStatusContainer.setBackgroundColor(colorOK); if (Utils.rootEnabled()) {
rootStatusIcon.setImageResource(statusAuto); // Mounted
rootStatusIcon.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP); rootStatusContainer.setBackgroundColor(colorWarn);
rootStatus.setTextColor(colorOK); rootStatusIcon.setImageResource(statusError);
rootStatus.setText(R.string.root_auto_unmounted); rootStatus.setTextColor(colorWarn);
rootToggle.setEnabled(false); rootStatus.setText(R.string.root_enabled);
autoRootToggle.setChecked(true); rootToggle.setChecked(true);
safetyNetStatusIcon.setImageResource(statusOK); safetyNetStatusIcon.setImageResource(statusError);
safetyNetStatus.setText(R.string.root_auto_unmounted_info); safetyNetStatus.setText(R.string.root_enabled_info);
break; break;
} else { } else {
rootToggle.setEnabled(true); // Disabled
if (Utils.rootEnabled()) { rootStatusContainer.setBackgroundColor(colorOK);
// Mounted rootStatusIcon.setImageResource(statusOK);
rootStatusContainer.setBackgroundColor(colorWarn); rootStatus.setTextColor(colorOK);
rootStatusIcon.setImageResource(statusError); rootStatus.setText(R.string.root_disabled);
rootStatus.setTextColor(colorWarn); rootToggle.setChecked(false);
rootStatus.setText(R.string.root_enabled); safetyNetStatusIcon.setImageResource(statusOK);
rootToggle.setChecked(true); safetyNetStatus.setText(R.string.root_disabled_info);
safetyNetStatusIcon.setImageResource(statusError); break;
safetyNetStatus.setText(R.string.root_enabled_info);
break;
} else {
// Disabled
rootStatusContainer.setBackgroundColor(colorOK);
rootStatusIcon.setImageResource(statusOK);
rootStatus.setTextColor(colorOK);
rootStatus.setText(R.string.root_disabled);
rootToggle.setChecked(false);
safetyNetStatusIcon.setImageResource(statusOK);
safetyNetStatus.setText(R.string.root_disabled_info);
break;
}
} }
case 2: case 2:
// Improper root // Improper root
@ -312,7 +232,6 @@ public class RootFragment extends Fragment {
rootToggle.setChecked(true); rootToggle.setChecked(true);
safetyNetStatusIcon.setImageResource(statusError); safetyNetStatusIcon.setImageResource(statusError);
safetyNetStatus.setText(R.string.root_system_info); safetyNetStatus.setText(R.string.root_system_info);
autoRootToggleView.setVisibility(View.GONE);
rootToggleView.setVisibility(View.GONE); rootToggleView.setVisibility(View.GONE);
selinuxToggleView.setVisibility(View.GONE); selinuxToggleView.setVisibility(View.GONE);
break; break;

View File

@ -51,21 +51,12 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
View view = super.onCreateView(inflater, container, savedInstanceState); View view = super.onCreateView(inflater, container, savedInstanceState);
themePreference = (ListPreference) findPreference("theme"); themePreference = (ListPreference) findPreference("theme");
CheckBoxPreference busyboxPreference = (CheckBoxPreference) findPreference("busybox"); CheckBoxPreference busyboxPreference = (CheckBoxPreference) findPreference("busybox");
CheckBoxPreference quickTilePreference = (CheckBoxPreference) findPreference("enable_quicktile");
busyboxPreference.setChecked(Utils.commandExists("unzip")); busyboxPreference.setChecked(Utils.commandExists("unzip"));
PreferenceManager.getDefaultSharedPreferences(getActivity()).registerOnSharedPreferenceChangeListener(this); PreferenceManager.getDefaultSharedPreferences(getActivity()).registerOnSharedPreferenceChangeListener(this);
CheckBoxPreference keepRootOffPreference = (CheckBoxPreference) findPreference("keep_root_off");
CheckBoxPreference hideRootNotificationPreference = (CheckBoxPreference) findPreference("hide_root_notification");
themePreference.setSummary(themePreference.getValue()); themePreference.setSummary(themePreference.getValue());
if (MagiskFragment.magiskVersion == -1) { if (MagiskFragment.magiskVersion == -1) {
quickTilePreference.setEnabled(false);
keepRootOffPreference.setEnabled(false);
hideRootNotificationPreference.setEnabled(false);
busyboxPreference.setEnabled(false); busyboxPreference.setEnabled(false);
} else { } else {
quickTilePreference.setEnabled(true);
keepRootOffPreference.setEnabled(true);
hideRootNotificationPreference.setEnabled(true);
busyboxPreference.setEnabled(true); busyboxPreference.setEnabled(true);
} }
@ -88,65 +79,35 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
Logger.dev("Settings: NewValue is " + key); Logger.dev("Settings: NewValue is " + key);
if (key.equals("theme")) { switch (key) {
String pref = sharedPreferences.getString(key, ""); case "theme":
String pref = sharedPreferences.getString(key, "");
themePreference.setSummary(pref); themePreference.setSummary(pref);
if (pref.equals("Dark")) { if (pref.equals("Dark")) {
getActivity().getApplication().setTheme(R.style.AppTheme_dh); getActivity().getApplication().setTheme(R.style.AppTheme_dh);
} else { } else {
getActivity().getApplication().setTheme(R.style.AppTheme); getActivity().getApplication().setTheme(R.style.AppTheme);
} }
Intent intent = new Intent(getActivity(), MainActivity.class); Intent intent = new Intent(getActivity(), MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("Relaunch", "Settings"); intent.putExtra("Relaunch", "Settings");
startActivity(intent); startActivity(intent);
Logger.dev("SettingsFragment: theme is " + pref); Logger.dev("SettingsFragment: theme is " + pref);
} else if (key.equals("enable_quicktile")) { break;
boolean checked = sharedPreferences.getBoolean("enable_quicktile", false); case "busybox":
if (checked) { boolean checked = sharedPreferences.getBoolean("busybox", false);
new AsyncTask<Void, Void, Boolean> () { new Async.LinkBusyBox(checked).executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
@Override break;
protected Boolean doInBackground(Void... voids) { case "developer_logging":
return Utils.installTile(getActivity()); Logger.devLog = sharedPreferences.getBoolean("developer_logging", false);
} break;
@Override case "shell_logging":
protected void onPostExecute(Boolean result) { Logger.logShell = sharedPreferences.getBoolean("shell_logging", false);
super.onPostExecute(result); break;
if (result) {
Toast.makeText(getActivity(), "Tile installed", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getActivity(), "Tile installation error", Toast.LENGTH_SHORT).show();
}
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
} else {
new AsyncTask<Void, Void, Boolean> () {
@Override
protected Boolean doInBackground(Void... voids) {
return Utils.uninstallTile(getActivity());
}
@Override
protected void onPostExecute(Boolean result) {
super.onPostExecute(result);
if (result) {
Toast.makeText(getActivity(), "Tile uninstalled", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getActivity(), "Tile uninstallation error", Toast.LENGTH_SHORT).show();
}
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}
} else if (key.equals("busybox")) {
boolean checked = sharedPreferences.getBoolean("busybox", false);
new Async.LinkBusyBox(checked).executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
} else if (key.equals("developer_logging")) {
Logger.devLog = sharedPreferences.getBoolean("developer_logging", false);
} else if (key.equals("shell_logging")) {
Logger.logShell = sharedPreferences.getBoolean("shell_logging", false);
} }
} }

View File

@ -7,7 +7,6 @@ import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import com.topjohnwu.magisk.services.MonitorService;
import com.topjohnwu.magisk.utils.Async; import com.topjohnwu.magisk.utils.Async;
import com.topjohnwu.magisk.utils.Logger; import com.topjohnwu.magisk.utils.Logger;
import com.topjohnwu.magisk.utils.Utils; import com.topjohnwu.magisk.utils.Utils;
@ -28,38 +27,6 @@ public class SplashActivity extends AppCompatActivity {
Logger.devLog = defaultPrefs.getBoolean("developer_logging", false); Logger.devLog = defaultPrefs.getBoolean("developer_logging", false);
Logger.logShell = defaultPrefs.getBoolean("shell_logging", false); Logger.logShell = defaultPrefs.getBoolean("shell_logging", false);
// Set up default preferences,make sure we add "extra" blacklist entries.
if (!defaultPrefs.contains("auto_blacklist")) {
Logger.dev("SplashActivity: Setting default preferences for application");
SharedPreferences.Editor editor = defaultPrefs.edit();
Set<String> set = new HashSet<>();
set.add("com.google.android.apps.walletnfcrel");
set.add("com.google.android.gms");
set.add("com.google.commerce.tapandpay");
editor.putStringSet("auto_blacklist", set);
editor.putBoolean("autoRootEnable", false);
editor.putBoolean("root", Utils.rootEnabled());
editor.apply();
}
// Set up toggle states based on preferences, start services, disable root if set
if (Utils.autoToggleEnabled(getApplicationContext())) {
if (!Utils.hasServicePermission(getApplicationContext())) {
Utils.toggleAutoRoot(false, getApplicationContext());
}
}
if (Utils.autoToggleEnabled(getApplicationContext())) {
if (!Utils.isMyServiceRunning(MonitorService.class, getApplicationContext())) {
Intent myIntent = new Intent(getApplication(), MonitorService.class);
getApplication().startService(myIntent);
}
} else if (defaultPrefs.getBoolean("keep_root_off", false)) {
Utils.toggleRoot(false, getApplication());
}
// Set up quick settings tile
Utils.setupQuickSettingsTile(getApplicationContext());
// Initialize // Initialize
Utils.init(this); Utils.init(this);
@ -67,6 +34,7 @@ public class SplashActivity extends AppCompatActivity {
.putBoolean("module_done", false) .putBoolean("module_done", false)
.putBoolean("repo_done", false) .putBoolean("repo_done", false)
.putBoolean("update_check_done", false) .putBoolean("update_check_done", false)
.putBoolean("root", Utils.rootEnabled())
.apply(); .apply();
new Async.CheckUpdates(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new Async.CheckUpdates(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

View File

@ -1,27 +0,0 @@
package com.topjohnwu.magisk.receivers;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.preference.PreferenceManager;
import android.util.Log;
import com.topjohnwu.magisk.services.MonitorService;
import com.topjohnwu.magisk.utils.Utils;
public class AutoStartReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("Magisk", "Received Boot call, attempting to start service");
Intent myIntent = new Intent(context, MonitorService.class);
context.startService(myIntent);
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("keep_root_off", false)) {
Utils.toggleRoot(false, context);
}
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("enable_quicktile", false)) {
Utils.setupQuickSettingsTile(context);
}
}
}

View File

@ -1,37 +0,0 @@
package com.topjohnwu.magisk.receivers;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.topjohnwu.magisk.utils.Utils;
/**
* Receiver for click events on the custom M Quick Settings tile
*/
public final class PrivateBroadcastReceiver extends BroadcastReceiver {
public static final String ACTION_AUTOROOT = "com.topjohnwu.magisk.CUSTOMTILE_ACTION_AUTOROOT";
public static final String ACTION_DISABLEROOT = "com.topjohnwu.magisk.CUSTOMTILE_ACTION_DISABLEROOT";
public static final String ACTION_ENABLEROOT = "com.topjohnwu.magisk.CUSTOMTILE_ACTION_ENABLEROOT";
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
Log.d("Magisk","Broadcast Receiver, Made it this far! We're trying to " + action);
if (ACTION_AUTOROOT.equals(action)) {
Utils.toggleAutoRoot(!Utils.autoToggleEnabled(context),context);
}
if (ACTION_ENABLEROOT.equals(action)) {
Utils.toggleAutoRoot(false, context);
Utils.toggleRoot(true, context);
}
if (ACTION_DISABLEROOT.equals(action)) {
Utils.toggleAutoRoot(false, context);
Utils.toggleRoot(false, context);
}
Utils.setupQuickSettingsTile(context);
}
}

View File

@ -1,158 +0,0 @@
package com.topjohnwu.magisk.services;
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.preference.PreferenceManager;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import android.view.accessibility.AccessibilityEvent;
import com.topjohnwu.magisk.MainActivity;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.utils.Logger;
import com.topjohnwu.magisk.utils.Utils;
import java.util.Set;
public class MonitorService extends AccessibilityService {
private Boolean disableroot;
@Override
protected void onServiceConnected() {
super.onServiceConnected();
//Configure these here for compatibility with API 13 and below.
AccessibilityServiceInfo config = new AccessibilityServiceInfo();
config.eventTypes = AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
config.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;
disableroot = false;
if (Build.VERSION.SDK_INT >= 16)
//Just in case this helps
config.flags = AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS;
setServiceInfo(config);
}
@Override
public void onCreate() {
super.onCreate();
Log.d("Magisk", "MonitorService: Service created");
}
@Override
public void onDestroy() {
super.onDestroy();
Log.d("Magisk", "MonitorService: Service destroyed");
}
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
ComponentName componentName = new ComponentName(
event.getPackageName().toString(),
event.getClassName().toString()
);
ActivityInfo activityInfo = tryGetActivity(componentName);
boolean isActivity = activityInfo != null;
if (isActivity) {
Logger.dev("MonitorService: CurrentActivity: " + event.getPackageName());
String mPackage = componentName.getPackageName();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
if (Utils.autoToggleEnabled(getApplicationContext())) {
Set<String> setBlackList = prefs.getStringSet("auto_blacklist", null);
if (setBlackList != null) {
disableroot = setBlackList.contains(mPackage);
ForceRoot(!disableroot);
String appFriendly = getAppName(mPackage);
ShowNotification(disableroot, appFriendly);
}
}
}
}
}
private ActivityInfo tryGetActivity(ComponentName componentName) {
try {
return getPackageManager().getActivityInfo(componentName, 0);
} catch (PackageManager.NameNotFoundException e) {
return null;
}
}
private String getAppName(String packageName) {
PackageManager pkManager = getPackageManager();
ApplicationInfo appInfo;
String appName;
try {
appInfo = pkManager.getApplicationInfo(packageName, 0);
appName = (String) ((appInfo != null) ? pkManager.getApplicationLabel(appInfo) : "???");
return appName;
} catch (final PackageManager.NameNotFoundException e) {
return "";
}
}
private void ForceRoot(Boolean rootToggle) {
String rootString = rootToggle ? "on" : "off";
if (Utils.rootEnabled() != rootToggle) {
Logger.dev("MonitorService: toggling root " + rootString);
Utils.toggleRoot(rootToggle, getApplicationContext());
if (Utils.rootEnabled() != rootToggle) {
Utils.toggleRoot(rootToggle, getApplicationContext());
Logger.dev("MonitorService: FORCING to " + rootString);
}
}
}
private void ShowNotification(boolean rootAction, String packageName) {
NotificationManager mNotifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
NotificationCompat.Builder mBuilder;
if (!PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean("hide_root_notification", false)) {
if (rootAction) {
Intent intent = new Intent(getApplication(), MainActivity.class);
intent.putExtra("relaunch", "relaunch");
String rootMessage;
PendingIntent pendingIntent = PendingIntent.getActivity(
getApplicationContext(),
0,
intent,
PendingIntent.FLAG_UPDATE_CURRENT);
if (packageName.equals("")) {
rootMessage = "Root has been disabled";
} else {
rootMessage = "Root has been disabled for " + packageName;
}
mBuilder =
new NotificationCompat.Builder(getApplicationContext())
.setSmallIcon(disableroot ? R.drawable.ic_stat_notification_autoroot_off : R.drawable.ic_stat_notification_autoroot_on)
.setContentIntent(pendingIntent)
.setContentTitle(getApplicationContext().getString(R.string.auto_toggle) + " status changed")
.setContentText(rootMessage);
int mNotificationId = 1;
mNotifyMgr.notify(mNotificationId, mBuilder.build());
} else {
mNotifyMgr.cancelAll();
}
}
}
@Override
public void onInterrupt() {
}
}

View File

@ -1,136 +0,0 @@
package com.topjohnwu.magisk.services;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.IBinder;
import com.kcoppock.broadcasttilesupport.BroadcastTileIntentBuilder;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.utils.Utils;
public class TileServiceCompat extends Service {
private static BroadcastReceiver clickTileReceiver;
private static boolean root, autoRoot;
public static final String TILE_ID = "Magisk";
public static final String ACTION_TILE_CLICK = "magisk.ACTION_TILE_CLICK";
public static final String EXTRA_CLICK_TYPE = "magisk.EXTRA_CLICK_TYPE";
public static final int CLICK_TYPE_UNKNOWN = -1;
public static final int CLICK_TYPE_SIMPLE = 0;
public static final int CLICK_TYPE_LONG = 1;
public TileServiceCompat() {
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
root = true;
registerClickTileReceiver();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
updateRoots();
updateTile();
return super.onStartCommand(intent, flags, startId);
}
private void updateRoots() {
root = Utils.rootEnabled();
autoRoot = Utils.autoToggleEnabled(getApplicationContext());
}
private void registerClickTileReceiver() {
clickTileReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
int clickType = intent.getIntExtra(EXTRA_CLICK_TYPE, CLICK_TYPE_UNKNOWN);
switch (clickType) {
case CLICK_TYPE_SIMPLE:
onSimpleClick();
break;
case CLICK_TYPE_LONG:
onLongClick();
break;
}
}
};
registerReceiver(clickTileReceiver, new IntentFilter(ACTION_TILE_CLICK));
}
private void onSimpleClick() {
updateRoots();
updateTile();
if (autoRoot) {
Utils.toggleAutoRoot(false, getApplicationContext());
if (!Utils.hasServicePermission(getApplicationContext())) {
Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(it);
}
} else {
Utils.toggleRoot(!root, getApplicationContext());
}
}
private void onLongClick() {
updateRoots();
updateTile();
Utils.toggleAutoRoot(!autoRoot,getApplicationContext());
if (!Utils.hasServicePermission(getApplicationContext())) {
Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(it);
}
}
private void updateTile() {
BroadcastTileIntentBuilder broadcastTileIntentBuilder = new BroadcastTileIntentBuilder(this, TILE_ID);
if (autoRoot) {
broadcastTileIntentBuilder.setLabel(getApplicationContext().getString(R.string.auto_toggle));
broadcastTileIntentBuilder.setIconResource(R.drawable.ic_autoroot_white);
} else {
if (root) {
broadcastTileIntentBuilder.setLabel("Root enabled");
broadcastTileIntentBuilder.setIconResource(R.drawable.root_white);
} else {
broadcastTileIntentBuilder.setLabel("Root disabled");
broadcastTileIntentBuilder.setIconResource(R.drawable.root_grey);
}
}
Intent simpleClick = new Intent(ACTION_TILE_CLICK);
simpleClick.putExtra(EXTRA_CLICK_TYPE, CLICK_TYPE_SIMPLE);
Intent longClick = new Intent(ACTION_TILE_CLICK);
longClick.putExtra(EXTRA_CLICK_TYPE, CLICK_TYPE_LONG);
broadcastTileIntentBuilder.setVisible(true);
broadcastTileIntentBuilder.setOnClickBroadcast(simpleClick);
broadcastTileIntentBuilder.setOnLongClickBroadcast(longClick);
this.sendBroadcast(broadcastTileIntentBuilder.build());
}
@Override
public void onDestroy() {
super.onDestroy();
unregisterReceiver(clickTileReceiver);
}
}

View File

@ -1,116 +0,0 @@
package com.topjohnwu.magisk.services;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.drawable.Icon;
import android.preference.PreferenceManager;
import android.service.quicksettings.Tile;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.utils.Logger;
import com.topjohnwu.magisk.utils.Utils;
@SuppressLint("NewApi")
public class TileServiceNewApi extends android.service.quicksettings.TileService {
private int mRootsState;
public TileServiceNewApi() {
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Logger.dev("QST (New): Service start");
return super.onStartCommand(intent, flags, startId);
}
@Override
public void onTileAdded() {
super.onTileAdded();
Logger.dev("QST (New): Tile added");
setupState();
this.getQsTile().updateTile();
}
@Override
public void onClick() {
mRootsState = Utils.CheckRootsState(getApplicationContext());
switchState(mRootsState);
Logger.dev("QST (New): Tile clicked");
}
@Override
public void onStartListening() {
super.onStartListening();
setupState();
Logger.dev("QST (New): Tile is listening");
}
@Override
public void onStopListening() {
super.onStopListening();
Logger.dev("QST (New): Tile stopped listening");
}
private void setupState() {
if (!Utils.hasServicePermission(getApplicationContext())) {
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putBoolean("autoRootEnable",false).apply();
}
mRootsState = Utils.CheckRootsState(getApplicationContext());
Logger.dev("QST (New): SetupState");
Icon iconRoot = Icon.createWithResource(getApplicationContext(), R.drawable.root);
Icon iconAuto = Icon.createWithResource(getApplicationContext(), R.drawable.ic_autoroot);
Tile tile = getQsTile();
Logger.dev("QST: State is " + mRootsState);
switch (mRootsState) {
case 2:
tile.setLabel(getApplicationContext().getString(R.string.auto_toggle));
tile.setIcon(iconAuto);
tile.setState(Tile.STATE_ACTIVE);
break;
case 1:
tile.setLabel("Root enabled");
tile.setIcon(iconRoot);
tile.setState(Tile.STATE_ACTIVE);
break;
default:
tile.setLabel("Root disabled");
tile.setIcon(iconRoot);
tile.setState(Tile.STATE_INACTIVE);
break;
}
tile.updateTile();
}
private void switchState(int rootsState) {
switch (rootsState) {
case 2:
Utils.toggleRoot(true, getApplicationContext());
if (!Utils.hasServicePermission(getApplicationContext())) {
Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(it);
}
Utils.toggleAutoRoot(false, getApplicationContext());
break;
case 1:
Utils.toggleRoot(false, getApplicationContext());
break;
case 0:
if (!Utils.hasServicePermission(getApplicationContext())) {
Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(it);
}
Utils.toggleAutoRoot(true, getApplicationContext());
break;
}
this.onStartListening();
setupState();
}
}

View File

@ -1,114 +0,0 @@
package com.topjohnwu.magisk.utils;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
import com.topjohnwu.magisk.R;
import java.util.List;
import java.util.Set;
public class ApplicationAdapter extends ArrayAdapter<ApplicationInfo> {
private List<ApplicationInfo> appsList = null;
private Context context;
private PackageManager packageManager;
public SharedPreferences prefs;
public ApplicationAdapter(Context context, int textViewResourceId,
List<ApplicationInfo> appsList) {
super(context, textViewResourceId, appsList);
this.context = context;
this.appsList = appsList;
packageManager = context.getPackageManager();
}
@Override
public int getCount() {
return ((null != appsList) ? appsList.size() : 0);
}
@Override
public ApplicationInfo getItem(int position) {
return ((null != appsList) ? appsList.get(position) : null);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = convertView;
prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
if (null == view) {
LayoutInflater layoutInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = layoutInflater.inflate(R.layout.list_item_app, null);
}
ApplicationInfo applicationInfo = appsList.get(position);
if (null != applicationInfo) {
TextView appName = (TextView) view.findViewById(R.id.app_name);
TextView packageName = (TextView) view.findViewById(R.id.app_paackage);
ImageView iconview = (ImageView) view.findViewById(R.id.app_icon);
CheckBox statusview = (CheckBox) view.findViewById(R.id.checkbox);
appName.setText(applicationInfo.loadLabel(packageManager));
packageName.setText(applicationInfo.packageName);
iconview.setImageDrawable(applicationInfo.loadIcon(packageManager));
if (CheckApp(applicationInfo.packageName)) {
statusview.setChecked(true);
} else {
statusview.setChecked(false);
}
}
return view;
}
public void UpdateRootStatusView(int position, View convertView) {
View view = convertView;
if (null == view) {
LayoutInflater layoutInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = layoutInflater.inflate(R.layout.list_item_app, null);
}
ApplicationInfo applicationInfo = appsList.get(position);
if (null != applicationInfo) {
CheckBox statusview = (CheckBox) view.findViewById(R.id.checkbox);
if (CheckApp(applicationInfo.packageName)) {
statusview.setChecked(true);
} else {
statusview.setChecked(false);
}
}
}
private boolean CheckApp(String appToCheck) {
boolean starter = false;
Set<String> set = prefs.getStringSet("auto_blacklist", null);
if (set != null) {
for (String string : set) {
if (string.equals(appToCheck)) {
starter = true;
}
}
}
return starter;
}
}

View File

@ -24,10 +24,6 @@ import com.kcoppock.broadcasttilesupport.BroadcastTileIntentBuilder;
import com.topjohnwu.magisk.MagiskFragment; import com.topjohnwu.magisk.MagiskFragment;
import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.receivers.DownloadReceiver; import com.topjohnwu.magisk.receivers.DownloadReceiver;
import com.topjohnwu.magisk.receivers.PrivateBroadcastReceiver;
import com.topjohnwu.magisk.services.MonitorService;
import com.topjohnwu.magisk.services.TileServiceCompat;
import com.topjohnwu.magisk.services.TileServiceNewApi;
import java.io.File; import java.io.File;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@ -88,13 +84,6 @@ public class Utils {
return commandExists("su"); return commandExists("su");
} }
public static boolean autoToggleEnabled(Context context) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
Logger.dev("Utils: AutoRootEnableCheck is " + preferences.getBoolean("autoRootEnable", false));
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("autoRootEnable", false);
}
public static boolean createFile(String path) { public static boolean createFile(String path) {
String command = "touch " + path + " 2>/dev/null; if [ -f " + path + " ]; then echo true; else echo false; fi"; String command = "touch " + path + " 2>/dev/null; if [ -f " + path + " ]; then echo true; else echo false; fi";
return Shell.rootAccess() && Boolean.parseBoolean(Shell.su(command).get(0)); return Shell.rootAccess() && Boolean.parseBoolean(Shell.su(command).get(0));
@ -112,38 +101,13 @@ public class Utils {
} else { } else {
Shell.su("rm -rf /magisk/.core/bin", "setprop magisk.root 0"); Shell.su("rm -rf /magisk/.core/bin", "setprop magisk.root 0");
} }
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("enable_quicktile", false)) { // if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("enable_quicktile", false)) {
setupQuickSettingsTile(context); // setupQuickSettingsTile(context);
} // }
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean("root", b).apply(); PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean("root", b).apply();
} }
} }
public static void toggleAutoRoot(Boolean b, Context context) {
Logger.dev("Utils: toggleAutocalled for " + b );
if (MagiskFragment.magiskVersion != -1) {
if (!Utils.hasServicePermission(context)) {
Intent intent = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS);
Toast.makeText(context, "Please enable Magisk in accessibility for auto-toggle work.", Toast.LENGTH_LONG).show();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
} else {
Logger.dev("Utils: toggleAuto checks passed, setting" + b );
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean("autoRootEnable", b).apply();
Intent myServiceIntent = new Intent(context, MonitorService.class);
myServiceIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (b) {
context.startService(myServiceIntent);
} else {
context.stopService(myServiceIntent);
}
}
}
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("enable_quicktile", false)) {
setupQuickSettingsTile(context);
}
}
static List<String> getModList(String path) { static List<String> getModList(String path) {
List<String> ret; List<String> ret;
String command = "find " + path + " -type d -maxdepth 1 ! -name \"*.core\" ! -name \"*lost+found\" ! -name \"*magisk\""; String command = "find " + path + " -type d -maxdepth 1 ! -name \"*.core\" ! -name \"*lost+found\" ! -name \"*magisk\"";
@ -208,195 +172,6 @@ public class Utils {
return secret; return secret;
} }
public static void setupQuickSettingsTile(Context mContext) {
Logger.dev("Utils: SetupQuickSettings called");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Logger.dev("Utils: Starting N quick settings service");
Intent serviceIntent = new Intent(mContext, TileServiceNewApi.class);
mContext.startService(serviceIntent);
}
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
Logger.dev("Utils: Marshmallow build detected");
String mLabelString;
int mRootIcon = R.drawable.root_white;
int mAutoRootIcon = R.drawable.ic_autoroot_white;
int mRootDisabled = R.drawable.root_grey;
int mRootsState = CheckRootsState(mContext);
Logger.dev("Utils: Root State returned as " + mRootsState);
final Intent enableBroadcast = new Intent(PrivateBroadcastReceiver.ACTION_ENABLEROOT);
final Intent disableBroadcast = new Intent(PrivateBroadcastReceiver.ACTION_DISABLEROOT);
final Intent autoBroadcast = new Intent(PrivateBroadcastReceiver.ACTION_AUTOROOT);
Intent intent;
int mIcon;
switch (mRootsState) {
case 2:
mLabelString = mContext.getString(R.string.auto_toggle);
mIcon = mAutoRootIcon;
intent = autoBroadcast;
break;
case 1:
mLabelString = "Root enabled";
mIcon = mRootIcon;
intent = disableBroadcast;
break;
case 0:
mLabelString = "Root disabled";
mIcon = mRootDisabled;
intent = enableBroadcast;
break;
default:
mLabelString = "Root disabled";
mIcon = mRootDisabled;
intent = disableBroadcast;
break;
}
Intent tileConfigurationIntent = new BroadcastTileIntentBuilder(mContext, "Magisk")
.setLabel(mLabelString)
.setIconResource(mIcon)
.setOnClickBroadcast(intent)
.setOnLongClickBroadcast(autoBroadcast)
.setVisible(true)
.build();
mContext.sendBroadcast(tileConfigurationIntent);
mContext.startService(new Intent(mContext, TileServiceCompat.class));
}
}
public static boolean installTile(Context context) {
String qsTileId;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
qsTileId = "custom(com.topjohnwu.magisk/.services.TileServiceNewApi)";
} else {
qsTileId = "intent(Magisk)";
}
List<String> lines = Shell.su("settings get secure sysui_qs_tiles");
if (lines != null && lines.size() == 1) {
List<String> tiles = new LinkedList<>(Arrays.asList(lines.get(0).split(",")));
Logger.dev("Utils: Current Tile String is " + tiles);
if (tiles.size() > 1) {
for (String tile : tiles) {
if (tile.equals(qsTileId)) {
return true;
}
}
tiles.add(Math.round(tiles.size() / 2), qsTileId);
String newTiles = TextUtils.join(",", tiles);
Logger.dev("Utils: NewtilesString is " + newTiles);
Shell.su("settings put secure sysui_qs_tiles \"" + newTiles + "\"");
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
Utils.refreshService(context);
}
return true;
}
}
return false;
}
public static boolean uninstallTile(Context context) {
String qsTileId;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
qsTileId = "custom(com.topjohnwu.magisk/.services.TileServiceNewApi)";
} else {
qsTileId = "intent(Magisk)";
}
List<String> lines = Shell.su("settings get secure sysui_qs_tiles");
if (lines != null && lines.size() == 1) {
List<String> tiles = new LinkedList<>(Arrays.asList(lines.get(0).split(",")));
if (tiles.size() > 1) {
boolean isPresent = false;
for (int i = 0; i < tiles.size(); i++) {
if (tiles.get(i).equals(qsTileId)) {
isPresent = true;
tiles.remove(i);
break;
}
}
if (isPresent) {
String newTiles = TextUtils.join(",", tiles);
Shell.su("settings put secure sysui_qs_tiles \"" + newTiles + "\"");
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
Utils.refreshService(context);
}
}
return true;
}
}
return false;
}
private static void refreshService(Context context) {
context.startService(new Intent(context, TileServiceCompat.class));
}
// Gets an overall state for the quick settings tile
// 0 for root disabled, 1 for root enabled (no auto), 2 for auto-root
public static int CheckRootsState(Context mContext) {
if (autoToggleEnabled(mContext)) {
return 2;
} else {
if (rootEnabled()) {
return 1;
} else {
return 0;
}
}
}
// To check if service is enabled
public static boolean hasServicePermission(Context mContext) {
int accessibilityEnabled = 0;
final String service = mContext.getPackageName() + "/" + MonitorService.class.getCanonicalName();
try {
accessibilityEnabled = Settings.Secure.getInt(
mContext.getApplicationContext().getContentResolver(),
android.provider.Settings.Secure.ACCESSIBILITY_ENABLED);
} catch (Settings.SettingNotFoundException e) {
Log.e(TAG, "Error finding setting, default accessibility to not found: "
+ e.getMessage());
}
TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');
if (accessibilityEnabled == 1) {
String settingValue = Settings.Secure.getString(
mContext.getApplicationContext().getContentResolver(),
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
if (settingValue != null) {
mStringColonSplitter.setString(settingValue);
while (mStringColonSplitter.hasNext()) {
String accessibilityService = mStringColonSplitter.next();
if (accessibilityService.equalsIgnoreCase(service)) {
return true;
}
}
}
} else {
Log.v(TAG, "***ACCESSIBILITY IS DISABLED***");
}
return false;
}
public static boolean isMyServiceRunning(Class<?> serviceClass, Context context) {
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (serviceClass.getName().equals(service.service.getClassName())) {
return true;
}
}
return false;
}
public interface ItemClickListener { public interface ItemClickListener {
void onItemClick(View view, int position); void onItemClick(View view, int position);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 749 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 749 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -1,4 +0,0 @@
<vector android:height="24dp" android:viewportHeight="400.0"
android:viewportWidth="400.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillAlpha="1.00" android:fillColor="#000000" android:pathData="M200.6,24.2C231.8,24.2 263,33 289.6,49.5C304.7,58.8 318.2,70.7 329.8,84.1C351.5,109.6 365.2,141.7 368.8,175C373.6,217.4 361.5,261.5 335.5,295.5C334.2,297.1 332.8,298.7 331.9,300.7C341.7,310.1 351,320 360.9,329.3C322.7,339.3 284.5,349.6 246.3,359.9C256.4,323.5 266,287 275.7,250.5C262.4,250.5 249.1,250.5 235.8,250.5C228.5,269.8 221.2,289.1 214.1,308.4C205.9,308.6 197.8,308.5 189.6,308.5C188.4,306.7 187.1,304.9 185.9,303C192.4,285.5 199.1,268 205.6,250.5C189.5,250.6 173.4,250.3 157.4,250.6C150.4,270 142.9,289.2 135.8,308.5C129.8,308.5 123.9,308.4 117.9,308.6C130.4,317.8 144,325.6 158.9,330.3C171.9,334.6 185.6,336.6 199.4,336.7C199.4,349.4 199.3,362.1 199.4,374.8C165.8,374.9 132.2,364.5 104.4,345.6C91.7,337 80.3,326.5 70.2,314.9C48.5,289.4 34.8,257.3 31.2,224C26.3,180.4 39.2,134.9 66.8,100.7C67.2,99.9 67.7,99.2 68.1,98.4C58.3,88.9 49,79 39.1,69.7C77.3,59.7 115.6,49.4 153.7,39.1C143.6,75.7 133.8,112.5 124.1,149.3C137.9,149.3 151.7,149.2 165.5,149.3C172.9,130 180.2,110.6 187.3,91.2C195.5,90.8 203.7,91 211.8,91C213,92.8 214.3,94.6 215.5,96.3C209.1,114 202.3,131.6 195.8,149.2C211.8,149.3 227.8,149.2 243.9,149.3C251.2,129.9 258.3,110.3 265.8,90.9C271.5,90.8 277.3,91.6 282.9,90.4C280.2,89.5 278.1,87.7 275.9,86.1C254,70.7 227.4,62.2 200.6,62.3C200.6,49.6 200.7,36.9 200.6,24.2M292.5,100C286.4,116.4 280.2,132.8 274,149.3C280.9,149.2 287.8,149.3 294.7,149.2C296,150.8 297.3,152.4 298.6,153.9C297.1,162.1 295.7,170.3 294.3,178.5C283.9,178.5 273.4,178.5 262.9,178.5C257.5,192.7 252.1,206.9 246.9,221.2C258.7,221.3 270.5,221.1 282.3,221.3C283.5,222.9 284.8,224.4 286.1,225.9C284.9,233.7 283.4,241.4 282.1,249.1C281.6,251 283.6,252.1 284.6,253.3C291.5,259.8 297.7,266.9 304.8,273.1C312.9,262.1 319.6,250.1 324.2,237.3C334.3,208.7 334.2,176.7 323.7,148.3C317,130.1 306.4,113.4 292.5,100M95.2,125.9C86.2,138 79,151.4 74.5,165.8C65.3,194.4 66.4,226.3 77.6,254.2C84.6,271.5 95.1,287.4 108.7,300.1C114.9,283.6 121.3,267.1 127.2,250.5C121.5,250.5 115.8,250.5 110,250.5C108.6,250.4 106.7,251 105.8,249.5C104.5,247.9 102.3,246.3 102.9,244.1C104.2,236.5 105.5,228.9 106.8,221.2C117.4,221.2 128.1,221.4 138.7,221.1C143.9,206.9 149.3,192.7 154.6,178.5C142.9,178.4 131.1,178.6 119.3,178.4C117.6,177.3 116.4,175.3 115,173.8C116.3,165.8 117.9,157.9 119,150C118.3,148.2 116.6,147.1 115.3,145.7C108.6,139.2 102.3,132.1 95.2,125.9M168.8,221.2C184.8,221.2 200.8,221.3 216.8,221.2C222.2,207 227.5,192.8 232.8,178.5C216.8,178.5 200.7,178.5 184.6,178.5C179.4,192.8 174,207 168.8,221.2Z"/>
</vector>

View File

@ -1,4 +0,0 @@
<vector android:height="24dp" android:viewportHeight="400.0"
android:viewportWidth="400.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillAlpha="1.00" android:fillColor="#fff" android:pathData="M200.6,24.2C231.8,24.2 263,33 289.6,49.5C304.7,58.8 318.2,70.7 329.8,84.1C351.5,109.6 365.2,141.7 368.8,175C373.6,217.4 361.5,261.5 335.5,295.5C334.2,297.1 332.8,298.7 331.9,300.7C341.7,310.1 351,320 360.9,329.3C322.7,339.3 284.5,349.6 246.3,359.9C256.4,323.5 266,287 275.7,250.5C262.4,250.5 249.1,250.5 235.8,250.5C228.5,269.8 221.2,289.1 214.1,308.4C205.9,308.6 197.8,308.5 189.6,308.5C188.4,306.7 187.1,304.9 185.9,303C192.4,285.5 199.1,268 205.6,250.5C189.5,250.6 173.4,250.3 157.4,250.6C150.4,270 142.9,289.2 135.8,308.5C129.8,308.5 123.9,308.4 117.9,308.6C130.4,317.8 144,325.6 158.9,330.3C171.9,334.6 185.6,336.6 199.4,336.7C199.4,349.4 199.3,362.1 199.4,374.8C165.8,374.9 132.2,364.5 104.4,345.6C91.7,337 80.3,326.5 70.2,314.9C48.5,289.4 34.8,257.3 31.2,224C26.3,180.4 39.2,134.9 66.8,100.7C67.2,99.9 67.7,99.2 68.1,98.4C58.3,88.9 49,79 39.1,69.7C77.3,59.7 115.6,49.4 153.7,39.1C143.6,75.7 133.8,112.5 124.1,149.3C137.9,149.3 151.7,149.2 165.5,149.3C172.9,130 180.2,110.6 187.3,91.2C195.5,90.8 203.7,91 211.8,91C213,92.8 214.3,94.6 215.5,96.3C209.1,114 202.3,131.6 195.8,149.2C211.8,149.3 227.8,149.2 243.9,149.3C251.2,129.9 258.3,110.3 265.8,90.9C271.5,90.8 277.3,91.6 282.9,90.4C280.2,89.5 278.1,87.7 275.9,86.1C254,70.7 227.4,62.2 200.6,62.3C200.6,49.6 200.7,36.9 200.6,24.2M292.5,100C286.4,116.4 280.2,132.8 274,149.3C280.9,149.2 287.8,149.3 294.7,149.2C296,150.8 297.3,152.4 298.6,153.9C297.1,162.1 295.7,170.3 294.3,178.5C283.9,178.5 273.4,178.5 262.9,178.5C257.5,192.7 252.1,206.9 246.9,221.2C258.7,221.3 270.5,221.1 282.3,221.3C283.5,222.9 284.8,224.4 286.1,225.9C284.9,233.7 283.4,241.4 282.1,249.1C281.6,251 283.6,252.1 284.6,253.3C291.5,259.8 297.7,266.9 304.8,273.1C312.9,262.1 319.6,250.1 324.2,237.3C334.3,208.7 334.2,176.7 323.7,148.3C317,130.1 306.4,113.4 292.5,100M95.2,125.9C86.2,138 79,151.4 74.5,165.8C65.3,194.4 66.4,226.3 77.6,254.2C84.6,271.5 95.1,287.4 108.7,300.1C114.9,283.6 121.3,267.1 127.2,250.5C121.5,250.5 115.8,250.5 110,250.5C108.6,250.4 106.7,251 105.8,249.5C104.5,247.9 102.3,246.3 102.9,244.1C104.2,236.5 105.5,228.9 106.8,221.2C117.4,221.2 128.1,221.4 138.7,221.1C143.9,206.9 149.3,192.7 154.6,178.5C142.9,178.4 131.1,178.6 119.3,178.4C117.6,177.3 116.4,175.3 115,173.8C116.3,165.8 117.9,157.9 119,150C118.3,148.2 116.6,147.1 115.3,145.7C108.6,139.2 102.3,132.1 95.2,125.9M168.8,221.2C184.8,221.2 200.8,221.3 216.8,221.2C222.2,207 227.5,192.8 232.8,178.5C216.8,178.5 200.7,178.5 184.6,178.5C179.4,192.8 174,207 168.8,221.2Z"/>
</vector>

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#666"
android:pathData="M3,5A2,2 0 0,1 5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5C3.89,21 3,20.1 3,19V5M7,18H9L9.35,16H13.35L13,18H15L15.35,16H17.35L17.71,14H15.71L16.41,10H18.41L18.76,8H16.76L17.12,6H15.12L14.76,8H10.76L11.12,6H9.12L8.76,8H6.76L6.41,10H8.41L7.71,14H5.71L5.35,16H7.35L7,18M10.41,10H14.41L13.71,14H9.71L10.41,10Z"/>
</vector>

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#fff"
android:pathData="M3,5A2,2 0 0,1 5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5C3.89,21 3,20.1 3,19V5M7,18H9L9.35,16H13.35L13,18H15L15.35,16H17.35L17.71,14H15.71L16.41,10H18.41L18.76,8H16.76L17.12,6H15.12L14.76,8H10.76L11.12,6H9.12L8.76,8H6.76L6.41,10H8.41L7.71,14H5.71L5.35,16H7.35L7,18M10.41,10H14.41L13.71,14H9.71L10.41,10Z"/>
</vector>

View File

@ -1,14 +0,0 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:id="@+id/Top">
<ListView android:id="@android:id/list"
android:divider="@android:color/transparent"
android:dividerHeight="@dimen/card_divider_space"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="6dp"/>
</LinearLayout>

View File

@ -1,89 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/card_vertical_margin"
android:layout_marginEnd="@dimen/card_horizontal_margin"
android:layout_marginStart="@dimen/card_horizontal_margin"
android:layout_marginTop="@dimen/card_vertical_margin"
style="?attr/cardStyle"
android:minHeight="?android:attr/listPreferredItemHeight"
card_view:cardCornerRadius="@dimen/card_corner_radius"
card_view:cardElevation="@dimen/card_elevation">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:padding="@dimen/card_layout_padding">
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/app_icon"
android:layout_width="@dimen/card_appicon_size"
android:layout_height="@dimen/card_appicon_size"
android:layout_centerVertical="true"
android:scaleType="centerCrop"/>
<LinearLayout
android:id="@+id/textLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignBottom="@+id/app_icon"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingEnd="@dimen/card_appicon_size"
android:paddingStart="65dp"
android:weightSum="1">
<TextView
android:id="@+id/app_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="false"
android:layout_weight="1"
android:paddingEnd="3dp"
android:paddingStart="3dp"
android:textStyle="bold"/>
<TextView
android:id="@+id/app_paackage"
android:layout_width="fill_parent"
android:layout_height="25dp"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:marqueeRepeatLimit="marquee_forever"
android:maxLines="1"
android:paddingEnd="3dp"
android:paddingStart="3dp"/>
</LinearLayout>
<LinearLayout
android:id="@+id/Linear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true">
<CheckBox
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:focusable="false"
android:gravity="center"
android:src="@drawable/ic_menu_overflow_material"/>
</LinearLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>

View File

@ -36,25 +36,6 @@
android:text="@string/root_toggle" android:text="@string/root_toggle"
android:textSize="16sp"/> android:textSize="16sp"/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="@+id/autoRootSwitchView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="2dp"
android:visibility="gone"
style="?attr/cardStyle"
app:cardCornerRadius="0dp">
<Switch
android:id="@+id/auto_root_toggle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:checked="false"
android:text="@string/auto_toggle"
android:textSize="16sp"/>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
<android.support.v7.widget.CardView <android.support.v7.widget.CardView

View File

@ -10,8 +10,6 @@
android:icon="@drawable/magisk" android:icon="@drawable/magisk"
android:title="@string/magisk"/> android:title="@string/magisk"/>
<item <item
android:id="@+id/modules" android:id="@+id/modules"
android:icon="@drawable/ic_extension" android:icon="@drawable/ic_extension"
@ -22,27 +20,11 @@
android:icon="@drawable/ic_cloud_download" android:icon="@drawable/ic_cloud_download"
android:title="@string/downloads"/> android:title="@string/downloads"/>
</group>
<group
android:checkableBehavior="single">
<item <item
android:id="@+id/root" android:id="@+id/root"
android:icon="@drawable/root" android:icon="@drawable/root"
android:title="@string/root"/> android:title="@string/root"/>
<item
android:id="@+id/autoroot"
android:icon="@drawable/ic_autoroot"
android:title="@string/auto_toggle"/>
</group>
<group
android:id="@+id/option_items"
android:checkableBehavior="single">
<item <item
android:id="@+id/log" android:id="@+id/log"
android:icon="@drawable/ic_bug_report" android:icon="@drawable/ic_bug_report"

View File

@ -11,5 +11,4 @@
<dimen name="card_textview_width">300dip</dimen> <dimen name="card_textview_width">300dip</dimen>
<dimen name="checkbox_padding">3dp</dimen> <dimen name="checkbox_padding">3dp</dimen>
<dimen name="card_imageview_margin">10dp</dimen> <dimen name="card_imageview_margin">10dp</dimen>
<dimen name="card_appicon_size">50dp</dimen>
</resources> </resources>

View File

@ -7,7 +7,6 @@
<string name="navigation_drawer_open">Open navigation drawer</string> <string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string> <string name="navigation_drawer_close">Close navigation drawer</string>
<string name="root">Root</string> <string name="root">Root</string>
<string name="auto_toggle">Auto-toggle</string>
<string name="modules">Modules</string> <string name="modules">Modules</string>
<string name="downloads">Downloads</string> <string name="downloads">Downloads</string>
<string name="log">Log</string> <string name="log">Log</string>
@ -34,8 +33,6 @@
<string name="root_enabled_info">Root enabled. Safety Net (Android Pay) will NOT work</string> <string name="root_enabled_info">Root enabled. Safety Net (Android Pay) will NOT work</string>
<string name="root_disabled">Root disabled</string> <string name="root_disabled">Root disabled</string>
<string name="root_disabled_info">Safety Net (Android Pay) should work, but no root temporarily\nYou might need to manually add a card in Android Pay app to refresh the root status of AP</string> <string name="root_disabled_info">Safety Net (Android Pay) should work, but no root temporarily\nYou might need to manually add a card in Android Pay app to refresh the root status of AP</string>
<string name="root_auto_unmounted">Root set to auto-toggle</string>
<string name="root_auto_unmounted_info">Root will auto unmount for selected applications. Safety Net (Android Pay) should work.</string>
<string name="root_system">Magisk Incompatible Root Detected</string> <string name="root_system">Magisk Incompatible Root Detected</string>
<string name="root_system_info">Root improperly installed. Safety Net (Android Pay) will NOT work, and impossible to toggle.</string> <string name="root_system_info">Root improperly installed. Safety Net (Android Pay) will NOT work, and impossible to toggle.</string>
@ -64,7 +61,6 @@
<string name="menuSaveToSd">Save to SD</string> <string name="menuSaveToSd">Save to SD</string>
<string name="menuSend">Send</string> <string name="menuSend">Send</string>
<string name="menuReload">Reload</string> <string name="menuReload">Reload</string>
<string name="sdcard_not_writable">SD card not found or not writable</string>
<string name="menuClearLog">Clear log now</string> <string name="menuClearLog">Clear log now</string>
<string name="logs_cleared">Log successfully cleared</string> <string name="logs_cleared">Log successfully cleared</string>
<string name="logs_clear_failed">Could not clear the log:</string> <string name="logs_clear_failed">Could not clear the log:</string>
@ -76,7 +72,7 @@
<string name="app_developers">Main developers</string> <string name="app_developers">Main developers</string>
<string name="app_developers_"><![CDATA[App created by <a href="https://github.com/topjohnwu">topjohnwu</a> in collaboration with <a href="https://github.com/d8ahazard">Digitalhigh</a> and <a href="https://github.com/dvdandroid">Dvdandroid</a>.]]></string> <string name="app_developers_"><![CDATA[App created by <a href="https://github.com/topjohnwu">topjohnwu</a> in collaboration with <a href="https://github.com/d8ahazard">Digitalhigh</a> and <a href="https://github.com/dvdandroid">Dvdandroid</a>.]]></string>
<string name="app_changelog">App\'s changelog</string> <string name="app_changelog">App\'s changelog</string>
<string name="translators"/> <string name="translators" />
<string name="app_version">App\'s version</string> <string name="app_version">App\'s version</string>
<string name="app_source_code">Source code</string> <string name="app_source_code">Source code</string>
<string name="donation">Donation</string> <string name="donation">Donation</string>
@ -87,7 +83,6 @@
<string name="permissionNotGranted">This feature will not work without permission to write external storage.</string> <string name="permissionNotGranted">This feature will not work without permission to write external storage.</string>
<string name="no_root_access">No root access, functionality limited</string> <string name="no_root_access">No root access, functionality limited</string>
<string name="no_thanks">No thanks</string> <string name="no_thanks">No thanks</string>
<string name="accessibility_service_description">Accessibility service required for Magisk auto-unroot feature</string>
<string name="update_title">%1$s Update!</string> <string name="update_title">%1$s Update!</string>
<string name="update_msg">New version v%2$s of %1$s is available!\nChangelog:\n%3$s</string> <string name="update_msg">New version v%2$s of %1$s is available!\nChangelog:\n%3$s</string>
<string name="repo_install_title">Install %1$s</string> <string name="repo_install_title">Install %1$s</string>
@ -117,20 +112,18 @@
<string name="settings_busybox_title">Enable BusyBox</string> <string name="settings_busybox_title">Enable BusyBox</string>
<string name="settings_busybox_summary">Make Magisk\'s built-in BusyBox be visible in PATH</string> <string name="settings_busybox_summary">Make Magisk\'s built-in BusyBox be visible in PATH</string>
<string name="settings_quicksettings_category">Quick Settings</string>
<string name="settings_enable_quicktile_title">Enable Quicksettings Tile</string>
<string name="settings_enable_quicktile_summary">Click here to enable or disable the quick settings tile.</string>
<string name="settings_root_category">Root</string>
<string name="settings_keep_root_off_summary">Disable root unless otherwise enabled by auto-toggle or toggle.</string>
<string name="settings_keep_root_off_title">Keep root turned off</string>
<string name="settings_hide_root_notification_summary">When checked, auto-toggle notifications will not be displayed.</string>
<string name="settings_hide_root_notification_title">Hide auto-toggle notifications</string>
<string name="settings_development_category">Development</string> <string name="settings_development_category">Development</string>
<string name="settings_developer_logging_title">Enable advanced debug logging</string> <string name="settings_developer_logging_title">Enable advanced debug logging</string>
<string name="settings_developer_logging_summary">Check this to enable more verbose logging.</string> <string name="settings_developer_logging_summary">Check this to enable more verbose logging.</string>
<string name="settings_shell_logging_title">Enable shell command debug logging</string> <string name="settings_shell_logging_title">Enable shell command debug logging</string>
<string name="settings_shell_logging_summary">Check this to enable logging all shell commands and output</string> <string name="settings_shell_logging_summary">Check this to enable logging all shell commands and output</string>
<!-- Strings related to Settings -->
<!-- Example General settings -->
<!-- Example settings for Data & Sync -->
<!-- Example settings for Notifications -->
</resources> </resources>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- These options MUST be specified here in order for the events to be received on first
start in Android 4.1.1 -->
<accessibility-service
xmlns:tools="http://schemas.android.com/tools"
android:accessibilityEventTypes="typeWindowStateChanged"
android:accessibilityFeedbackType="feedbackGeneric"
android:accessibilityFlags="flagIncludeNotImportantViews"
android:description="@string/accessibility_service_description"
xmlns:android="http://schemas.android.com/apk/res/android"
tools:ignore="UnusedAttribute"/>

View File

@ -20,34 +20,6 @@
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory
android:title="@string/settings_quicksettings_category">
<CheckBoxPreference
android:key="enable_quicktile"
android:defaultValue="false"
android:title="@string/settings_enable_quicktile_title"
android:summary="@string/settings_enable_quicktile_summary" />
</PreferenceCategory>
<PreferenceCategory
android:title="@string/settings_root_category">
<CheckBoxPreference
android:key="keep_root_off"
android:defaultValue="false"
android:title="@string/settings_keep_root_off_title"
android:summary="@string/settings_keep_root_off_summary" />
<CheckBoxPreference
android:key="hide_root_notification"
android:defaultValue="false"
android:title="@string/settings_hide_root_notification_title"
android:summary="@string/settings_hide_root_notification_summary" />
</PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:title="@string/settings_development_category"> android:title="@string/settings_development_category">