Ready for release

This commit is contained in:
topjohnwu 2016-09-29 23:24:31 +08:00
parent 692b993eee
commit e4cba70008
30 changed files with 541 additions and 414 deletions

View File

@ -2,13 +2,13 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 24 compileSdkVersion 24
buildToolsVersion "24.0.2" buildToolsVersion "24.0.3"
defaultConfig { defaultConfig {
applicationId "com.topjohnwu.magisk" applicationId "com.topjohnwu.magisk"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 24 targetSdkVersion 24
versionCode 4 versionCode 5
versionName "2.0" versionName "2.0"
jackOptions { jackOptions {
enabled true enabled true
@ -32,9 +32,9 @@ repositories {
dependencies { dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs') compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:recyclerview-v7:24.2.0' compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.0' compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:design:24.2.0' compile 'com.android.support:design:24.2.1'
compile 'com.github.d8ahazard:BroadcastTileSupportUpdate:master' compile 'com.github.d8ahazard:BroadcastTileSupportUpdate:master'
compile 'com.getkeepsafe.taptargetview:taptargetview:1.2.0' compile 'com.getkeepsafe.taptargetview:taptargetview:1.2.0'
compile 'com.jakewharton:butterknife:8.4.0' compile 'com.jakewharton:butterknife:8.4.0'

View File

@ -29,7 +29,9 @@ 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/android/software/mod-magisk-v1-universal-systemless-t3432382"; private static final String XDA_THREAD = "http://forum.xda-developers.com/showthread.php?t=3432382";
private static final String DONATION_URL = "http://topjohnwu.github.io/donate";
private AlertDialog.Builder builder; private AlertDialog.Builder builder;
@BindView(R.id.toolbar) Toolbar toolbar; @BindView(R.id.toolbar) Toolbar toolbar;
@ -39,6 +41,7 @@ public class AboutActivity extends AppCompatActivity {
@BindView(R.id.app_translators) RowItem appTranslators; @BindView(R.id.app_translators) RowItem appTranslators;
@BindView(R.id.app_source_code) RowItem appSourceCode; @BindView(R.id.app_source_code) RowItem appSourceCode;
@BindView(R.id.support_thread) RowItem supportThread; @BindView(R.id.support_thread) RowItem supportThread;
@BindView(R.id.donation) RowItem donation;
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
@ -139,6 +142,9 @@ public class AboutActivity extends AppCompatActivity {
supportThread.removeSummary(); supportThread.removeSummary();
supportThread.setOnClickListener(view -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(XDA_THREAD)))); supportThread.setOnClickListener(view -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(XDA_THREAD))));
donation.removeSummary();
donation.setOnClickListener(view -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(DONATION_URL))));
setFloating(); setFloating();
} }

View File

@ -90,10 +90,7 @@ public class LogFragment extends Fragment {
reloadErrorLog(); reloadErrorLog();
return true; return true;
case R.id.menu_send: case R.id.menu_send:
try { send();
send();
} catch (NullPointerException ignored) {
}
return true; return true;
case R.id.menu_save: case R.id.menu_save:
save(); save();
@ -117,11 +114,23 @@ public class LogFragment extends Fragment {
} }
private void send() { private void send() {
Intent sendIntent = new Intent(); new SaveLog() {
sendIntent.setAction(Intent.ACTION_SEND); @Override
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(save())); protected void onPostExecute(Boolean bool) {
sendIntent.setType("application/html"); super.onPostExecute(bool);
startActivity(Intent.createChooser(sendIntent, getResources().getString(R.string.menuSend))); if (bool) {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(targetFile));
sendIntent.setType("application/html");
startActivity(Intent.createChooser(sendIntent, getResources().getString(R.string.menuSend)));
} else {
Toast.makeText(getActivity(), getString(R.string.logs_save_failed), Toast.LENGTH_LONG).show();
}
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
} }
@Override @Override
@ -138,45 +147,66 @@ public class LogFragment extends Fragment {
} }
} }
@SuppressLint("DefaultLocale") private void save() {
private File save() { new SaveLog(){
if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { @Override
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { protected void onPostExecute(Boolean bool) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0); super.onPostExecute(bool);
if (bool) {
Toast.makeText(getActivity(), targetFile.toString(), Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getActivity(), getString(R.string.logs_save_failed), Toast.LENGTH_LONG).show();
}
} }
return null; }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
} }
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { private class SaveLog extends AsyncTask<Void, Void, Boolean> {
Snackbar.make(txtLog, R.string.sdcard_not_writable, Snackbar.LENGTH_LONG).show();
return null;
}
Calendar now = Calendar.getInstance(); File targetFile;
String filename = String.format(
"magisk_%s_%04d%02d%02d_%02d%02d%02d.log", "error",
now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1,
now.get(Calendar.DAY_OF_MONTH), now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE), now.get(Calendar.SECOND));
File dir = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Magisk/"); @SuppressLint("DefaultLocale")
dir.mkdir(); @Override
protected Boolean doInBackground(Void... voids) {
File targetFile = new File(dir, filename); if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
List<String> in = Utils.readFile(MAGISK_LOG); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
try { }
FileWriter out = new FileWriter(targetFile); return false;
for (String line : in) {
out.write(line + "\n");
} }
out.close();
Toast.makeText(getActivity(), targetFile.toString(), Toast.LENGTH_LONG).show(); if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
return targetFile; return false;
} catch (IOException e) { }
Toast.makeText(getActivity(), getResources().getString(R.string.logs_save_failed) + "\n" + e.getMessage(), Toast.LENGTH_LONG).show();
return null; Calendar now = Calendar.getInstance();
String filename = String.format(
"magisk_%s_%04d%02d%02d_%02d%02d%02d.log", "error",
now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1,
now.get(Calendar.DAY_OF_MONTH), now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE), now.get(Calendar.SECOND));
targetFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/MagiskManager/" + filename);
if ((!targetFile.getParentFile().exists() && !targetFile.getParentFile().mkdirs()) || (targetFile.exists() && !targetFile.delete())) {
return false;
}
List<String> in = Utils.readFile(MAGISK_LOG);
try {
FileWriter out = new FileWriter(targetFile);
for (String line : in) {
out.write(line + "\n");
}
out.close();
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
} }
} }

View File

@ -152,7 +152,7 @@ public class MagiskFragment extends Fragment {
private void updateUI() { private void updateUI() {
String theme = PreferenceManager.getDefaultSharedPreferences(getActivity()).getString("theme", ""); String theme = PreferenceManager.getDefaultSharedPreferences(getActivity()).getString("theme", "");
if (theme.equals("Dark")) { if (theme.equals("Dark")) {
builder = new AlertDialog.Builder(getActivity(),R.style.AlertDialog_dh); builder = new AlertDialog.Builder(getActivity(), R.style.AlertDialog_dh);
} else { } else {
builder = new AlertDialog.Builder(getActivity()); builder = new AlertDialog.Builder(getActivity());
} }
@ -190,11 +190,28 @@ public class MagiskFragment extends Fragment {
"Magisk-v" + String.valueOf(remoteMagiskVersion) + ".zip")) "Magisk-v" + String.valueOf(remoteMagiskVersion) + ".zip"))
.setNegativeButton(R.string.no_thanks, null) .setNegativeButton(R.string.no_thanks, null)
.show()); .show());
} else { } else {
magiskCheckUpdatesContainer.setBackgroundColor(colorOK); magiskCheckUpdatesContainer.setBackgroundColor(colorOK);
magiskCheckUpdatesIcon.setImageResource(R.drawable.ic_check_circle); magiskCheckUpdatesIcon.setImageResource(R.drawable.ic_check_circle);
magiskCheckUpdatesStatus.setText(getString(R.string.up_to_date, getString(R.string.magisk))); magiskCheckUpdatesStatus.setText(getString(R.string.up_to_date, getString(R.string.magisk)));
magiskCheckUpdatesStatus.setTextColor(colorOK); magiskCheckUpdatesStatus.setTextColor(colorOK);
magiskUpdateView.setOnClickListener(view -> builder
.setTitle(getString(R.string.repo_install_title, getString(R.string.magisk)))
.setMessage(getString(R.string.repo_install_msg, "Magisk-v" + String.valueOf(remoteMagiskVersion)))
.setCancelable(true)
.setPositiveButton(R.string.download_install, (dialogInterface, i) -> Utils.downloadAndReceive(
getActivity(),
new DownloadReceiver() {
@Override
public void task(Uri uri) {
new Async.FlashZIP(mContext, uri).executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}
},
magiskLink,
"Magisk-v" + String.valueOf(remoteMagiskVersion) + ".zip"))
.setNegativeButton(R.string.no_thanks, null)
.show());
} }
if (remoteAppVersionCode > BuildConfig.VERSION_CODE) { if (remoteAppVersionCode > BuildConfig.VERSION_CODE) {

View File

@ -35,12 +35,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private final Handler mDrawerHandler = new Handler(); private final Handler mDrawerHandler = new Handler();
private String currentTitle; private String currentTitle;
@BindView(R.id.toolbar) @BindView(R.id.toolbar) Toolbar toolbar;
Toolbar toolbar; @BindView(R.id.drawer_layout) DrawerLayout drawer;
@BindView(R.id.drawer_layout) @BindView(R.id.nav_view) NavigationView navigationView;
DrawerLayout drawer;
@BindView(R.id.nav_view)
NavigationView navigationView;
@IdRes @IdRes
private int mSelectedId = R.id.magisk; private int mSelectedId = R.id.magisk;

View File

@ -67,7 +67,6 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
@Override @Override
public void onBindViewHolder(final ViewHolder holder, int position) { public void onBindViewHolder(final ViewHolder holder, int position) {
final Module module = mList.get(position); final Module module = mList.get(position);
Log.d("Magisk", "ModulesAdapter: Trying set up bindview from list pos " + position + " and " + module.getName());
if (module.isCache()) { if (module.isCache()) {
holder.title.setText("[Cache] " + module.getName()); holder.title.setText("[Cache] " + module.getName());
} else { } else {

View File

@ -61,7 +61,7 @@ public class ModulesFragment extends Fragment {
mSwipeRefreshLayout.setOnRefreshListener(() -> { mSwipeRefreshLayout.setOnRefreshListener(() -> {
recyclerView.setVisibility(View.GONE); recyclerView.setVisibility(View.GONE);
prefs.edit().putBoolean("module_done", false).apply(); prefs.edit().putBoolean("module_done", false).apply();
new Async.LoadModules(getActivity()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new Async.LoadModules(getActivity()).executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}); });
if (prefs.getBoolean("module_done", false)) { if (prefs.getBoolean("module_done", false)) {

View File

@ -4,9 +4,12 @@ import android.animation.Animator;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.animation.ValueAnimator; import android.animation.ValueAnimator;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
@ -39,6 +42,7 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
private final List<Repo> mList; private final List<Repo> mList;
private View mView; private View mView;
private Context context; private Context context;
private AlertDialog.Builder builder;
public ReposAdapter(List<Repo> list) { public ReposAdapter(List<Repo> list) {
mList = list; mList = list;
@ -49,6 +53,14 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
mView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_repo, parent, false); mView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_repo, parent, false);
ButterKnife.bind(this, mView); ButterKnife.bind(this, mView);
context = parent.getContext(); context = parent.getContext();
String theme = PreferenceManager.getDefaultSharedPreferences(context).getString("theme", "");
if (theme.equals("Dark")) {
builder = new AlertDialog.Builder(context,R.style.AlertDialog_dh);
} else {
builder = new AlertDialog.Builder(context);
}
return new ViewHolder(mView); return new ViewHolder(mView);
} }
@ -75,44 +87,51 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
View.OnClickListener listener = view -> { View.OnClickListener listener = view -> {
if (view.getId() == holder.updateImage.getId()) { if (view.getId() == holder.updateImage.getId()) {
Utils.downloadAndReceive( String fullname = repo.getName() + "-" + repo.getVersion();
context, builder
new DownloadReceiver(repo.getName() + "-" + repo.getVersion()) { .setTitle(context.getString(R.string.repo_install_title, repo.getName()))
@Override .setMessage(context.getString(R.string.repo_install_msg, fullname))
public void task(Uri uri) { .setCancelable(true)
new Async.FlashZIP(context, uri, mName) { .setPositiveButton(R.string.download_install, (dialogInterface, i) -> Utils.downloadAndReceive(
context,
new DownloadReceiver(fullname) {
@Override @Override
protected void preProcessing() throws Throwable { public void task(Uri uri) {
super.preProcessing(); new Async.FlashZIP(context, uri, mName) {
new File(mUri.getPath()).delete(); @Override
Shell.su( protected void preProcessing() throws Throwable {
"cd " + mFile.getParent(), super.preProcessing();
"mkdir git", new File(mUri.getPath()).delete();
"unzip -o install.zip -d git", Shell.su(
"mv git/* install", "cd " + mFile.getParent(),
"cd install", "mkdir git",
"rm -rf system/placeholder", "unzip -o install.zip -d git",
"chmod 644 $(find . -type f)", "mv git/* install",
"chmod 755 $(find . -type d)", "cd install",
"rm -rf ../install.zip ../git", "rm -rf system/placeholder",
"zip -r ../install.zip *", "chmod 644 $(find . -type f)",
"rm -rf ../install" "chmod 755 $(find . -type d)",
); "rm -rf ../install.zip ../git",
"zip -r ../install.zip *",
"rm -rf ../install"
);
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
} }
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); },
} repo.getZipUrl(),
}, repo.getId().replace(" ", "") + ".zip"))
repo.getZipUrl(), .setNegativeButton(R.string.no_thanks, null)
repo.getId().replace(" ", "") + ".zip"); .show();
} }
if ((view.getId() == holder.changeLog.getId()) && (!repo.getLogUrl().equals(""))) { if ((view.getId() == holder.changeLog.getId()) && (!repo.getLogUrl().equals(""))) {
new WebWindow("Changelog", repo.getLogUrl(), context); new WebWindow(context.getString(R.string.changelog), repo.getLogUrl(), context);
} }
if ((view.getId() == holder.authorLink.getId()) && (!repo.getSupportUrl().equals(""))) { if ((view.getId() == holder.authorLink.getId()) && (!repo.getSupportUrl().equals(""))) {
new WebWindow("Donate", repo.getDonateUrl(), context); context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(repo.getDonateUrl())));
} }
if ((view.getId() == holder.supportLink.getId()) && (!repo.getSupportUrl().equals(""))) { if ((view.getId() == holder.supportLink.getId()) && (!repo.getSupportUrl().equals(""))) {
new WebWindow("Support", repo.getSupportUrl(), context); context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(repo.getSupportUrl())));
} }
}; };

View File

@ -89,6 +89,8 @@ public class RootFragment extends Fragment {
ta3.recycle(); ta3.recycle();
autoRootStatus = Utils.autoToggleEnabled(getActivity()); autoRootStatus = Utils.autoToggleEnabled(getActivity());
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
if (autoRootStatus) { if (autoRootStatus) {
if (!Utils.hasServicePermission(getActivity())) { if (!Utils.hasServicePermission(getActivity())) {
autoRootStatus = false; autoRootStatus = false;
@ -96,9 +98,18 @@ public class RootFragment extends Fragment {
} }
rootToggle.setEnabled(!autoRootStatus); rootToggle.setEnabled(!autoRootStatus);
autoRootToggle.setChecked(autoRootStatus); autoRootToggle.setChecked(autoRootStatus);
new updateUI().executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); updateUI();
rootToggle.setOnClickListener(toggle -> Utils.toggleRoot(((CompoundButton) toggle).isChecked(), getActivity())); rootToggle.setOnClickListener(toggle -> {
new AsyncTask<Boolean, Void, Void>() {
@Override
protected Void doInBackground(Boolean... bools) {
Utils.toggleRoot(bools[0], getActivity());
return null;
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, ((CompoundButton) toggle).isChecked());
});
autoRootToggle.setOnClickListener(toggle -> { autoRootToggle.setOnClickListener(toggle -> {
if (!Utils.hasServicePermission(getActivity())) { if (!Utils.hasServicePermission(getActivity())) {
@ -106,7 +117,7 @@ public class RootFragment extends Fragment {
Toast.makeText(getActivity(), "Please enable accessibility access for Magisk's auto-toggle feature to work.", Toast.LENGTH_LONG).show(); Toast.makeText(getActivity(), "Please enable accessibility access for Magisk's auto-toggle feature to work.", Toast.LENGTH_LONG).show();
startActivityForResult(intent, 100); startActivityForResult(intent, 100);
} else { } else {
ToggleAutoRoot(autoRootToggle.isChecked()); toggleAutoRoot(autoRootToggle.isChecked());
} }
} }
@ -114,19 +125,45 @@ public class RootFragment extends Fragment {
); );
selinuxToggle.setOnClickListener(toggle -> { selinuxToggle.setOnClickListener(toggle -> {
Shell.su(((CompoundButton) toggle).isChecked() ? "setenforce 1" : "setenforce 0");
new updateUI().executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); new AsyncTask<Boolean, Void, Void>() {
@Override
protected Void doInBackground(Boolean... bools) {
Shell.su(bools[0] ? "setenforce 1" : "setenforce 0");
return null;
}
@Override
protected void onPostExecute(Void v) {
super.onPostExecute(v);
updateUI();
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, ((CompoundButton) toggle).isChecked());
}); });
return view; return view;
} }
@Override
public void onResume() {
super.onResume();
getActivity().setTitle(R.string.root);
listener = (pref, key) -> {
if ((key.contains("autoRootEnable")) || (key.equals("root"))) {
Logger.dev("RootFragmnet, keychange detected for " + key);
//new updateUI().execute();
updateUI();
}
};
prefs.registerOnSharedPreferenceChangeListener(listener);
updateUI();
}
@Override @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
if (null != listener) { prefs.unregisterOnSharedPreferenceChangeListener(listener);
prefs.unregisterOnSharedPreferenceChangeListener(listener);
}
} }
@Override @Override
@ -135,7 +172,7 @@ public class RootFragment extends Fragment {
Log.d("Magisk", "Got result: " + requestCode + " and " + resultCode); Log.d("Magisk", "Got result: " + requestCode + " and " + resultCode);
if (requestCode == 100) { if (requestCode == 100) {
if (Utils.hasServicePermission(getActivity())) { if (Utils.hasServicePermission(getActivity())) {
ToggleAutoRoot(true); toggleAutoRoot(true);
Snackbar.make(view, getActivity().getString(R.string.auto_toggle) + " has been enabled.", Snackbar.LENGTH_LONG).show(); Snackbar.make(view, getActivity().getString(R.string.auto_toggle) + " has been enabled.", Snackbar.LENGTH_LONG).show();
} else { } else {
@ -146,7 +183,7 @@ public class RootFragment extends Fragment {
} }
} }
private void ToggleAutoRoot(boolean toggleState) { private void toggleAutoRoot(boolean toggleState) {
autoRootStatus = toggleState; autoRootStatus = toggleState;
Utils.toggleAutoRoot(toggleState, getActivity()); Utils.toggleAutoRoot(toggleState, getActivity());
if (toggleState) { if (toggleState) {
@ -166,155 +203,119 @@ public class RootFragment extends Fragment {
} }
@Override private void updateUI() {
public void onResume() { autoRootToggle.setChecked(autoRootStatus);
super.onResume(); progressBar.setVisibility(View.GONE);
getActivity().setTitle("Root"); rootStatusView.setVisibility(View.VISIBLE);
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); safetynetStatusView.setVisibility(View.VISIBLE);
listener = (prefs1, key) -> { selinuxStatusView.setVisibility(View.VISIBLE);
if ((key.contains("autoRootEnable")) | (key.equals("root"))) { if (Shell.rootAccess()) {
Logger.dev("RootFragmnet, keychange detected for " + key); rootToggleView.setVisibility(View.VISIBLE);
new updateUI().execute(); autoRootToggleView.setVisibility(View.VISIBLE);
} selinuxToggleView.setVisibility(View.VISIBLE);
};
prefs.registerOnSharedPreferenceChangeListener(listener);
new updateUI().execute();
}
public class updateUI extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... voids) {
// Make sure static block invoked
Shell.rootAccess();
// Set up Tile on UI Refresh
if (PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean("enable_quicktile", false)) {
Utils.SetupQuickSettingsTile(getActivity());
}
autoRootStatus = Utils.autoToggleEnabled(getActivity());
return null;
} }
@Override List<String> selinux = Shell.sh("getenforce");
protected void onPostExecute(Void v) {
super.onPostExecute(v);
autoRootToggle.setChecked(autoRootStatus);
progressBar.setVisibility(View.GONE);
rootStatusView.setVisibility(View.VISIBLE);
safetynetStatusView.setVisibility(View.VISIBLE);
selinuxStatusView.setVisibility(View.VISIBLE);
if (Shell.rootAccess()) { if (selinux.isEmpty()) {
rootToggleView.setVisibility(View.VISIBLE); selinuxStatusContainer.setBackgroundColor(colorNeutral);
autoRootToggleView.setVisibility(View.VISIBLE); selinuxStatusIcon.setImageResource(statusUnknown);
selinuxToggleView.setVisibility(View.VISIBLE);
}
List<String> selinux = Shell.sh("getenforce"); selinuxStatus.setText(R.string.selinux_error_info);
selinuxStatus.setTextColor(colorNeutral);
selinuxToggle.setChecked(false);
} else if (selinux.get(0).equals("Enforcing")) {
selinuxStatusContainer.setBackgroundColor(colorOK);
selinuxStatusIcon.setImageResource(statusOK);
if (selinux.isEmpty()) { selinuxStatus.setText(R.string.selinux_enforcing_info);
selinuxStatusContainer.setBackgroundColor(colorNeutral); selinuxStatus.setTextColor(colorOK);
selinuxStatusIcon.setImageResource(statusUnknown); selinuxToggle.setChecked(true);
} else {
selinuxStatusContainer.setBackgroundColor(colorFail);
selinuxStatusIcon.setImageResource(statusError);
selinuxStatus.setText(R.string.selinux_error_info); selinuxStatus.setText(R.string.selinux_permissive_info);
selinuxStatus.setTextColor(colorNeutral); selinuxStatus.setTextColor(colorFail);
selinuxToggle.setChecked(false); selinuxToggle.setChecked(false);
} else if (selinux.get(0).equals("Enforcing")) { }
selinuxStatusContainer.setBackgroundColor(colorOK);
selinuxStatusIcon.setImageResource(statusOK);
selinuxStatus.setText(R.string.selinux_enforcing_info); if (new File("/system/framework/twframework.jar").exists()) {
selinuxStatus.setTextColor(colorOK); selinuxStatus.append("\n" + getString(R.string.selinux_samsung_info));
selinuxToggle.setChecked(true); }
} else {
selinuxStatusContainer.setBackgroundColor(colorFail);
selinuxStatusIcon.setImageResource(statusError);
selinuxStatus.setText(R.string.selinux_permissive_info); switch (Shell.rootStatus) {
selinuxStatus.setTextColor(colorFail); case -1:
selinuxToggle.setChecked(false); // Root Error
} rootStatusContainer.setBackgroundColor(colorFail);
rootStatusIcon.setImageResource(statusUnknown);
if (new File("/system/framework/twframework.jar").exists()) { rootStatus.setTextColor(colorNeutral);
selinuxStatus.append("\n" + getString(R.string.selinux_samsung_info)); rootStatus.setText(R.string.root_error);
} rootToggle.setChecked(false);
safetyNetStatusIcon.setImageResource(statusUnknown);
switch (Shell.rootStatus) { safetyNetStatus.setText(R.string.root_error_info);
case -1: break;
// Root Error case 0:
rootStatusContainer.setBackgroundColor(colorFail); // Not rooted
rootStatusIcon.setImageResource(statusUnknown); rootStatusContainer.setBackgroundColor(colorOK);
rootStatus.setTextColor(colorNeutral); rootStatusIcon.setImageResource(statusOK);
rootStatus.setText(R.string.root_error); rootStatus.setTextColor(colorOK);
rootToggle.setChecked(false); rootStatus.setText(R.string.root_none);
safetyNetStatusIcon.setImageResource(statusUnknown); rootToggle.setChecked(false);
safetyNetStatus.setText(R.string.root_error_info); safetyNetStatusIcon.setImageResource(statusOK);
break; safetyNetStatus.setText(R.string.root_none_info);
case 0: break;
// Not rooted case 1:
// Proper root
if (autoRootStatus) {
rootStatusContainer.setBackgroundColor(colorOK); rootStatusContainer.setBackgroundColor(colorOK);
rootStatusIcon.setImageResource(statusOK); rootStatusIcon.setImageResource(statusAuto);
rootStatusIcon.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
rootStatus.setTextColor(colorOK); rootStatus.setTextColor(colorOK);
rootStatus.setText(R.string.root_none); rootStatus.setText(R.string.root_auto_unmounted);
rootToggle.setChecked(false); rootToggle.setEnabled(false);
autoRootToggle.setChecked(true);
safetyNetStatusIcon.setImageResource(statusOK); safetyNetStatusIcon.setImageResource(statusOK);
safetyNetStatus.setText(R.string.root_none_info); safetyNetStatus.setText(R.string.root_auto_unmounted_info);
break; break;
case 1: } else {
// Proper root rootToggle.setEnabled(true);
if (autoRootStatus) { if (Utils.rootEnabled()) {
rootStatusContainer.setBackgroundColor(colorOK); // Mounted
rootStatusIcon.setImageResource(statusAuto); rootStatusContainer.setBackgroundColor(colorWarn);
rootStatusIcon.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP); rootStatusIcon.setImageResource(statusError);
rootStatus.setTextColor(colorOK); rootStatus.setTextColor(colorWarn);
rootStatus.setText(R.string.root_auto_unmounted); rootStatus.setText(R.string.root_enabled);
rootToggle.setEnabled(false); rootToggle.setChecked(true);
autoRootToggle.setChecked(true); safetyNetStatusIcon.setImageResource(statusError);
safetyNetStatusIcon.setImageResource(statusOK); safetyNetStatus.setText(R.string.root_enabled_info);
safetyNetStatus.setText(R.string.root_auto_unmounted_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: }
// Improper root case 2:
rootStatusContainer.setBackgroundColor(colorFail); // Improper root
rootStatusIcon.setImageResource(statusError); rootStatusContainer.setBackgroundColor(colorFail);
rootStatus.setTextColor(colorFail); rootStatusIcon.setImageResource(statusError);
rootStatus.setText(R.string.root_system); rootStatus.setTextColor(colorFail);
rootToggle.setChecked(true); rootStatus.setText(R.string.root_system);
safetyNetStatusIcon.setImageResource(statusError); rootToggle.setChecked(true);
safetyNetStatus.setText(R.string.root_system_info); safetyNetStatusIcon.setImageResource(statusError);
autoRootToggleView.setVisibility(View.GONE); safetyNetStatus.setText(R.string.root_system_info);
rootToggleView.setVisibility(View.GONE); autoRootToggleView.setVisibility(View.GONE);
selinuxToggleView.setVisibility(View.GONE); rootToggleView.setVisibility(View.GONE);
break; selinuxToggleView.setVisibility(View.GONE);
} break;
} }
} }

View File

@ -2,6 +2,7 @@ package com.topjohnwu.magisk;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
import android.preference.ListPreference; import android.preference.ListPreference;
@ -12,19 +13,18 @@ import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Toast;
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;
import butterknife.ButterKnife; import butterknife.ButterKnife;
public class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener { public class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
private CheckBoxPreference quickTilePreference; private CheckBoxPreference quickTilePreference, busyboxPreference;
private ListPreference themePreference; private ListPreference themePreference;
public SettingsFragment() {
}
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -50,9 +50,10 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState); View view = super.onCreateView(inflater, container, savedInstanceState);
ButterKnife.bind(this, view);
quickTilePreference = (CheckBoxPreference) findPreference("enable_quicktile");
themePreference = (ListPreference) findPreference("theme"); themePreference = (ListPreference) findPreference("theme");
busyboxPreference = (CheckBoxPreference) findPreference("busybox");
quickTilePreference = (CheckBoxPreference) findPreference("enable_quicktile") ;
busyboxPreference.setChecked(Utils.commandExists("unzip"));
PreferenceManager.getDefaultSharedPreferences(getActivity()).registerOnSharedPreferenceChangeListener(this); PreferenceManager.getDefaultSharedPreferences(getActivity()).registerOnSharedPreferenceChangeListener(this);
CheckBoxPreference keepRootOffPreference = (CheckBoxPreference) findPreference("keep_root_off"); CheckBoxPreference keepRootOffPreference = (CheckBoxPreference) findPreference("keep_root_off");
CheckBoxPreference hideRootNotificationPreference = (CheckBoxPreference) findPreference("hide_root_notification"); CheckBoxPreference hideRootNotificationPreference = (CheckBoxPreference) findPreference("hide_root_notification");
@ -67,21 +68,6 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
hideRootNotificationPreference.setEnabled(true); hideRootNotificationPreference.setEnabled(true);
} }
Preference.OnPreferenceClickListener preferenceClickListener = preference -> {
if (preference == quickTilePreference) {
boolean isChecked = quickTilePreference.isChecked();
if (isChecked) {
Utils.installTile(getActivity());
} else {
Utils.uninstallTile(getActivity());
}
}
return false;
};
quickTilePreference.setOnPreferenceClickListener(preferenceClickListener);
// calculate margins // calculate margins
int horizontalMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics()); int horizontalMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics());
int verticalMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics()); int verticalMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics());
@ -118,6 +104,44 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
Logger.dev("SettingsFragment: theme is " + pref); Logger.dev("SettingsFragment: theme is " + pref);
} else if (key.equals("enable_quicktile")) {
boolean checked = sharedPreferences.getBoolean("enable_quicktile", false);
if (checked) {
new AsyncTask<Void, Void, Boolean> () {
@Override
protected Boolean doInBackground(Void... voids) {
return Utils.installTile(getActivity());
}
@Override
protected void onPostExecute(Boolean result) {
super.onPostExecute(result);
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);
} }
} }

View File

@ -19,7 +19,6 @@ public class SplashActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
SharedPreferences defaultPrefs = PreferenceManager.getDefaultSharedPreferences(getApplication()); SharedPreferences defaultPrefs = PreferenceManager.getDefaultSharedPreferences(getApplication());
if (defaultPrefs.getString("theme","").equals("Dark")) { if (defaultPrefs.getString("theme","").equals("Dark")) {
@ -35,8 +34,8 @@ public class SplashActivity extends AppCompatActivity {
set.add("com.google.android.gms"); set.add("com.google.android.gms");
set.add("com.google.commerce.tapandpay"); set.add("com.google.commerce.tapandpay");
editor.putStringSet("auto_blacklist", set); editor.putStringSet("auto_blacklist", set);
editor.putBoolean("autoRootEnable",false); editor.putBoolean("autoRootEnable", false);
editor.putBoolean("root",Utils.rootEnabled()); editor.putBoolean("root", Utils.rootEnabled());
editor.apply(); editor.apply();
} }
@ -56,7 +55,7 @@ public class SplashActivity extends AppCompatActivity {
} }
// Set up quick settings tile // Set up quick settings tile
Utils.SetupQuickSettingsTile(getApplicationContext()); Utils.setupQuickSettingsTile(getApplicationContext());
// Initialize // Initialize
Utils.init(this); Utils.init(this);

View File

@ -1,5 +1,7 @@
package com.topjohnwu.magisk.module; package com.topjohnwu.magisk.module;
import android.os.AsyncTask;
import com.topjohnwu.magisk.utils.Logger; import com.topjohnwu.magisk.utils.Logger;
import com.topjohnwu.magisk.utils.ModuleHelper; import com.topjohnwu.magisk.utils.ModuleHelper;
import com.topjohnwu.magisk.utils.Utils; import com.topjohnwu.magisk.utils.Utils;
@ -34,11 +36,23 @@ public class Module extends BaseModule {
} }
public void createDisableFile() { public void createDisableFile() {
mEnable = !Utils.createFile(mDisableFile); new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... voids) {
mEnable = !Utils.createFile(mDisableFile);
return null;
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
} }
public void removeDisableFile() { public void removeDisableFile() {
mEnable = Utils.removeFile(mDisableFile); new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... voids) {
mEnable = Utils.removeFile(mDisableFile);
return null;
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
} }
public boolean isEnabled() { public boolean isEnabled() {
@ -46,11 +60,23 @@ public class Module extends BaseModule {
} }
public void createRemoveFile() { public void createRemoveFile() {
mRemove = Utils.createFile(mRemoveFile); new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... voids) {
mRemove = Utils.createFile(mRemoveFile);
return null;
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
} }
public void deleteRemoveFile() { public void deleteRemoveFile() {
mRemove = !Utils.removeFile(mRemoveFile); new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... voids) {
mRemove = !Utils.removeFile(mRemoveFile);
return null;
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
} }
public boolean willBeRemoved() { public boolean willBeRemoved() {

View File

@ -19,7 +19,7 @@ public class AutoStartReceiver extends BroadcastReceiver {
Utils.toggleRoot(false, context); Utils.toggleRoot(false, context);
} }
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("enable_quicktile", false)) { if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("enable_quicktile", false)) {
Utils.SetupQuickSettingsTile(context); Utils.setupQuickSettingsTile(context);
} }

View File

@ -32,6 +32,6 @@ public final class PrivateBroadcastReceiver extends BroadcastReceiver {
Utils.toggleRoot(false, context); Utils.toggleRoot(false, context);
} }
Utils.SetupQuickSettingsTile(context); Utils.setupQuickSettingsTile(context);
} }
} }

View File

@ -46,16 +46,18 @@ public class Async {
String busybox = mContext.getApplicationInfo().dataDir + "/lib/libbusybox.so"; String busybox = mContext.getApplicationInfo().dataDir + "/lib/libbusybox.so";
String zip = mContext.getApplicationInfo().dataDir + "/lib/libzip.so"; String zip = mContext.getApplicationInfo().dataDir + "/lib/libzip.so";
if (Shell.rootAccess()) { if (Shell.rootAccess()) {
if (!Utils.commandExists("unzip") || !Utils.commandExists("zip") || !Utils.itemExist(toolPath)) { if (!Utils.itemExist(toolPath)) {
Shell.sh( Shell.sh(
"rm -rf " + toolPath, "rm -rf " + toolPath,
"mkdir " + toolPath, "mkdir " + toolPath,
"chmod 755 " + toolPath, "chmod 755 " + toolPath,
"ln -s " + busybox + " " + toolPath + "/busybox", "cd " + toolPath,
"for tool in $(" + toolPath + "/busybox --list); do", "ln -s " + busybox + " busybox",
"ln -s " + busybox + " " + toolPath + "/$tool", "for tool in $(./busybox --list); do",
"ln -s " + busybox + " $tool",
"done", "done",
"ln -s " + zip + " " + toolPath + "/zip" "rm -f su sh",
"ln -s " + zip + " zip"
); );
} }
} }
@ -165,15 +167,18 @@ public class Async {
mContext = context; mContext = context;
mUri = uri; mUri = uri;
Cursor c = mContext.getContentResolver().query(uri, null, null, null, null); Cursor c = mContext.getContentResolver().query(uri, null, null, null, null);
int nameIndex = c.getColumnIndex(OpenableColumns.DISPLAY_NAME); if (c != null) {
c.moveToFirst(); int nameIndex = c.getColumnIndex(OpenableColumns.DISPLAY_NAME);
if (nameIndex != -1) { c.moveToFirst();
mName = c.getString(nameIndex); if (nameIndex != -1) {
} else { mName = c.getString(nameIndex);
}
c.close();
}
if (mName == null) {
int idx = uri.getPath().lastIndexOf('/'); int idx = uri.getPath().lastIndexOf('/');
mName = uri.getPath().substring(idx + 1); mName = uri.getPath().substring(idx + 1);
} }
c.close();
copyToSD = false; copyToSD = false;
} }
@ -296,6 +301,10 @@ public class Async {
} }
protected void done() { protected void done() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
prefs.edit().putBoolean("module_done", false).apply();
new LoadModules(mContext).executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
AlertDialog.Builder builder; AlertDialog.Builder builder;
String theme = PreferenceManager.getDefaultSharedPreferences(mContext).getString("theme", ""); String theme = PreferenceManager.getDefaultSharedPreferences(mContext).getString("theme", "");
if (theme.equals("Dark")) { if (theme.equals("Dark")) {
@ -306,9 +315,31 @@ public class Async {
builder builder
.setTitle(R.string.reboot_title) .setTitle(R.string.reboot_title)
.setMessage(R.string.reboot_msg) .setMessage(R.string.reboot_msg)
.setPositiveButton(R.string.reboot, (dialogInterface1, i) -> Shell.su("sh -c reboot")) .setPositiveButton(R.string.reboot, (dialogInterface1, i) -> Shell.sh("su -c reboot"))
.setNegativeButton(R.string.no_thanks, null) .setNegativeButton(R.string.no_thanks, null)
.show(); .show();
} }
} }
public static class LinkBusyBox extends AsyncTask<Void, Void, Void> {
private boolean link;
public LinkBusyBox(boolean b) {
link = b;
}
@Override
protected Void doInBackground(Void... voids) {
if (link) {
Shell.su(
"rm -rf /magisk/.core/busybox",
"ln -s /data/busybox /magisk/.core/busybox"
);
} else {
Shell.su("rm -rf /magisk/.core/busybox");
}
return null;
}
}
} }

View File

@ -23,7 +23,6 @@ import android.widget.Toast;
import com.kcoppock.broadcasttilesupport.BroadcastTileIntentBuilder; 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.module.BaseModule;
import com.topjohnwu.magisk.receivers.DownloadReceiver; import com.topjohnwu.magisk.receivers.DownloadReceiver;
import com.topjohnwu.magisk.receivers.PrivateBroadcastReceiver; import com.topjohnwu.magisk.receivers.PrivateBroadcastReceiver;
import com.topjohnwu.magisk.services.MonitorService; import com.topjohnwu.magisk.services.MonitorService;
@ -36,7 +35,6 @@ import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException; import java.security.spec.InvalidKeySpecException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -63,7 +61,7 @@ public class Utils {
MagiskFragment.magiskVersion = Integer.parseInt(ret.get(0)); MagiskFragment.magiskVersion = Integer.parseInt(ret.get(0));
} }
String toolPath = context.getApplicationInfo().dataDir + "/tools"; String toolPath = context.getApplicationInfo().dataDir + "/tools";
Shell.su("PATH=$PATH:" + toolPath); Shell.su("PATH=" + toolPath + ":$PATH");
} }
public static boolean itemExist(String path) { public static boolean itemExist(String path) {
@ -113,7 +111,7 @@ public class Utils {
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();
} }
@ -140,7 +138,7 @@ public class Utils {
} }
} }
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("enable_quicktile", false)) { if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("enable_quicktile", false)) {
SetupQuickSettingsTile(context); setupQuickSettingsTile(context);
} }
} }
@ -174,7 +172,7 @@ public class Utils {
} }
if ((!file.getParentFile().exists() && !file.getParentFile().mkdirs()) || (file.exists() && !file.delete())) { if ((!file.getParentFile().exists() && !file.getParentFile().mkdirs()) || (file.exists() && !file.delete())) {
Toast.makeText(context, R.string.toast_error_makedir, Toast.LENGTH_LONG).show(); Toast.makeText(context, R.string.permissionNotGranted, Toast.LENGTH_LONG).show();
} }
DownloadManager downloadManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE); DownloadManager downloadManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
@ -208,7 +206,7 @@ public class Utils {
return secret; return secret;
} }
public static void SetupQuickSettingsTile(Context mContext) { public static void setupQuickSettingsTile(Context mContext) {
Logger.dev("Utils: SetupQuickSettings called"); Logger.dev("Utils: SetupQuickSettings called");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Logger.dev("Utils: Starting N quick settings service"); Logger.dev("Utils: Starting N quick settings service");
@ -266,7 +264,7 @@ public class Utils {
} }
} }
public static void installTile(Context context) { public static boolean installTile(Context context) {
String qsTileId; String qsTileId;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
qsTileId = "custom(com.topjohnwu.magisk/.services.TileServiceNewApi)"; qsTileId = "custom(com.topjohnwu.magisk/.services.TileServiceNewApi)";
@ -281,8 +279,7 @@ public class Utils {
if (tiles.size() > 1) { if (tiles.size() > 1) {
for (String tile : tiles) { for (String tile : tiles) {
if (tile.equals(qsTileId)) { if (tile.equals(qsTileId)) {
Toast.makeText(context, "Tile already installed", Toast.LENGTH_SHORT).show(); return true;
return;
} }
} }
@ -290,17 +287,16 @@ public class Utils {
String newTiles = TextUtils.join(",", tiles); String newTiles = TextUtils.join(",", tiles);
Logger.dev("Utils: NewtilesString is " + newTiles); Logger.dev("Utils: NewtilesString is " + newTiles);
Shell.su("settings put secure sysui_qs_tiles \"" + newTiles + "\""); Shell.su("settings put secure sysui_qs_tiles \"" + newTiles + "\"");
Toast.makeText(context, "Tile installed", Toast.LENGTH_SHORT).show();
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
Utils.refreshService(context); Utils.refreshService(context);
} }
return; return true;
} }
} }
Toast.makeText(context, "Tile installation error", Toast.LENGTH_SHORT).show(); return false;
} }
public static void uninstallTile(Context context) { public static boolean uninstallTile(Context context) {
String qsTileId; String qsTileId;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
@ -323,17 +319,15 @@ public class Utils {
if (isPresent) { if (isPresent) {
String newTiles = TextUtils.join(",", tiles); String newTiles = TextUtils.join(",", tiles);
Shell.su("settings put secure sysui_qs_tiles \"" + newTiles + "\""); Shell.su("settings put secure sysui_qs_tiles \"" + newTiles + "\"");
Toast.makeText(context, "Tile uninstalled", Toast.LENGTH_SHORT).show();
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
Utils.refreshService(context); Utils.refreshService(context);
} }
return;
} }
Toast.makeText(context, "Tile already uninstalled", Toast.LENGTH_SHORT).show(); return true;
} }
} }
Toast.makeText(context, "Tile uninstallation error", Toast.LENGTH_SHORT).show(); return false;
} }
private static void refreshService(Context context) { private static void refreshService(Context context) {

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator">
<alpha
android:duration="250"
android:fromAlpha="0.1"
android:toAlpha="1.0"/>
</set>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator">
<alpha
android:duration="250"
android:fromAlpha="1.0"
android:toAlpha="0.1"/>
</set>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#757575"
android:pathData="M11.8,10.9c-2.27,-0.59 -3,-1.2 -3,-2.15 0,-1.09 1.01,-1.85 2.7,-1.85 1.78,0 2.44,0.85 2.5,2.1h2.21c-0.07,-1.72 -1.12,-3.3 -3.21,-3.81V3h-3v2.16c-1.94,0.42 -3.5,1.68 -3.5,3.61 0,2.31 1.91,3.46 4.7,4.13 2.5,0.6 3,1.48 3,2.41 0,0.69 -0.49,1.79 -2.7,1.79 -2.06,0 -2.87,-0.92 -2.98,-2.1h-2.2c0.12,2.19 1.76,3.42 3.68,3.83V21h3v-2.15c1.95,-0.37 3.5,-1.5 3.5,-3.55 0,-2.84 -2.43,-3.81 -4.7,-4.4z"/>
</vector>

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M9,16.2L4.8,12l-1.4,1.4L9,19 21,7l-1.4,-1.4L9,16.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:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#757575"
android:pathData="M12,16.5l4,-4h-3v-9h-2v9L8,12.5l4,4zM21,3.5h-6v1.99h6v14.03L3,19.52L3,5.49h6L9,3.5L3,3.5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2v-14c0,-1.1 -0.9,-2 -2,-2z"/>
</vector>

View File

@ -104,12 +104,27 @@
style="?attr/cardStyle" style="?attr/cardStyle"
app:cardUseCompatPadding="true"> app:cardUseCompatPadding="true">
<com.topjohnwu.magisk.RowItem <LinearLayout
android:id="@+id/support_thread" android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:icon="@drawable/ic_xda" android:layout_marginBottom="8dp"
app:text="@string/support_thread"/> android:orientation="vertical">
<com.topjohnwu.magisk.RowItem
android:id="@+id/support_thread"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_xda"
app:text="@string/support_thread"/>
<com.topjohnwu.magisk.RowItem
android:id="@+id/donation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_attach_money"
app:text="@string/donation"/>
</LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content" android:layout_width="fill_parent"
android:layout_gravity="center" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/card_vertical_margin" android:layout_gravity="center"
android:layout_marginEnd="@dimen/card_horizontal_margin" android:layout_marginBottom="@dimen/card_vertical_margin"
android:layout_marginStart="@dimen/card_horizontal_margin" android:layout_marginEnd="@dimen/card_horizontal_margin"
android:layout_marginTop="@dimen/card_vertical_margin" android:layout_marginStart="@dimen/card_horizontal_margin"
android:layout_marginTop="@dimen/card_vertical_margin"
style="?attr/cardStyle" style="?attr/cardStyle"
android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="?android:attr/listPreferredItemHeight"
card_view:cardCornerRadius="@dimen/card_corner_radius" card_view:cardCornerRadius="@dimen/card_corner_radius"
card_view:cardElevation="@dimen/card_elevation"> card_view:cardElevation="@dimen/card_elevation">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -21,13 +21,13 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:padding="@dimen/card_layout_padding"> android:padding="@dimen/card_layout_padding">
<ImageView xmlns:android="http://schemas.android.com/apk/res/android" <ImageView
android:id="@+id/app_icon" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/card_appicon_size" android:id="@+id/app_icon"
android:layout_height="@dimen/card_appicon_size" android:layout_width="@dimen/card_appicon_size"
android:layout_centerVertical="true" android:layout_height="@dimen/card_appicon_size"
android:layout_centerVertical="true"
android:scaleType="centerCrop"/> android:scaleType="centerCrop"/>
<LinearLayout <LinearLayout
android:id="@+id/textLayout" android:id="@+id/textLayout"
@ -77,8 +77,8 @@
android:clickable="false" android:clickable="false"
android:focusable="false" android:focusable="false"
android:gravity="center" android:gravity="center"
android:src="@drawable/ic_menu_overflow_material" android:src="@drawable/ic_menu_overflow_material"/>
/>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -10,15 +10,7 @@
android:icon="@drawable/magisk" android:icon="@drawable/magisk"
android:title="@string/magisk"/> android:title="@string/magisk"/>
<item
android:id="@+id/root"
android:icon="@drawable/root"
android:title="@string/root"/>
<item
android:id="@+id/autoroot"
android:icon="@drawable/ic_autoroot"
android:title="@string/auto_toggle"/>
<item <item
android:id="@+id/modules" android:id="@+id/modules"
@ -30,6 +22,27 @@
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
android:id="@+id/root"
android:icon="@drawable/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"
@ -42,15 +55,9 @@
</group> </group>
<group <item
android:id="@+id/option_items" android:id="@+id/app_about"
android:checkableBehavior="none"> android:icon="@drawable/ic_info_outline"
android:title="@string/about"/>
<item
android:id="@+id/app_about"
android:icon="@drawable/ic_info_outline"
android:title="@string/about"/>
</group>
</menu> </menu>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/force_reload"
android:icon="@drawable/ic_refresh"
android:title="@string/menuReload"
app:showAsAction="always"/>
</menu>

View File

@ -4,27 +4,21 @@
<color name="primary">#009688</color> <color name="primary">#009688</color>
<color name="primary_dark">#00796B</color> <color name="primary_dark">#00796B</color>
<color name="accent">#FFC107</color> <color name="accent">#FFC107</color>
<color name="primary_text">#212121</color>
<color name="icons">#FFFFFF</color>
<color name="icon_grey">#757575</color> <color name="icon_grey">#757575</color>
<color name="red500">#F44336</color> <color name="red500">#F44336</color>
<color name="green500">#4CAF50</color> <color name="green500">#4CAF50</color>
<color name="blue500">#2196F3</color>
<color name="grey500">#9E9E9E</color> <color name="grey500">#9E9E9E</color>
<color name="yellow500">#FFC107</color> <color name="yellow500">#FFC107</color>
<color name="dh_primary">#3F51B5</color> <color name="dh_primary">#3F51B5</color>
<color name="dh_primary_dark">#303F9F</color> <color name="dh_primary_dark">#303F9F</color>
<color name="dh_primary_light">#C5CAE9</color>
<color name="dh_accent">#448AFF</color> <color name="dh_accent">#448AFF</color>
<color name="dh_primary_text">#dedede</color> <color name="dh_primary_text">#dedede</color>
<color name="dh_secondary_text">#8A8A8A</color>
<color name="dh_icons">#dedede</color> <color name="dh_icons">#dedede</color>
<color name="dh_divider">#313131</color> <color name="dh_divider">#313131</color>
<color name="dh_alertWarn">#FF9800</color> <color name="dh_alertWarn">#FF9800</color>
<color name="dh_alertOk">@color/dh_accent</color> <color name="dh_alertOk">@color/dh_accent</color>
<color name="dh_alertNeutral">@color/dh_primary_light</color>
<color name="dh_alertFail">@color/red500</color> <color name="dh_alertFail">@color/red500</color>

View File

@ -2,7 +2,6 @@
<resources> <resources>
<dimen name="floating_height">650dp</dimen> <dimen name="floating_height">650dp</dimen>
<dimen name="floating_width">500dp</dimen> <dimen name="floating_width">500dp</dimen>
<dimen name="min_rowheight">100dp</dimen>
<dimen name="card_divider_space">5sp</dimen> <dimen name="card_divider_space">5sp</dimen>
<dimen name="card_horizontal_margin">8dip</dimen> <dimen name="card_horizontal_margin">8dip</dimen>
<dimen name="card_vertical_margin">3dip</dimen> <dimen name="card_vertical_margin">3dip</dimen>

View File

@ -24,7 +24,6 @@
<!--Root Fragment--> <!--Root Fragment-->
<string name="root_toggle">Root Toggle</string> <string name="root_toggle">Root Toggle</string>
<string name="auto_root">Auto Root</string>
<string name="selinux_toggle">SELinux Toggle</string> <string name="selinux_toggle">SELinux Toggle</string>
<string name="root_error">Root Error</string> <string name="root_error">Root Error</string>
@ -48,7 +47,6 @@
<!--Module Fragment--> <!--Module Fragment-->
<string name="no_info_provided">(No info provided)</string> <string name="no_info_provided">(No info provided)</string>
<string name="no_modules_found">No modules found</string> <string name="no_modules_found">No modules found</string>
<string name="module_not_installed">Module is not installed</string>
<string name="update_file_created">Module will be updated at next reboot</string> <string name="update_file_created">Module will be updated at next reboot</string>
<string name="remove_file_created">Module will be removed at next reboot</string> <string name="remove_file_created">Module will be removed at next reboot</string>
<string name="remove_file_deleted">Module will not be removed at next reboot</string> <string name="remove_file_deleted">Module will not be removed at next reboot</string>
@ -60,6 +58,7 @@
<string name="update_available">Update Available</string> <string name="update_available">Update Available</string>
<string name="installed">Installed</string> <string name="installed">Installed</string>
<string name="not_installed">Not Installed</string> <string name="not_installed">Not Installed</string>
<string name="changelog">Changelog</string>
<!--Log Fragment--> <!--Log Fragment-->
<string name="menuSaveToSd">Save to SD</string> <string name="menuSaveToSd">Save to SD</string>
@ -80,6 +79,7 @@
<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="app_translators">App\'s translators</string> <string name="app_translators">App\'s translators</string>
<string name="support_thread">Support thread</string> <string name="support_thread">Support thread</string>
@ -90,6 +90,8 @@
<string name="accessibility_service_description">Accessibility service required for Magisk auto-unroot feature</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_msg">Do you want to install %1$s ?</string>
<string name="download_install">Download and install</string> <string name="download_install">Download and install</string>
<string name="download_file_error">Error downloading file</string> <string name="download_file_error">Error downloading file</string>
<string name="install_error">Installation error!</string> <string name="install_error">Installation error!</string>
@ -102,10 +104,6 @@
<string name="zip_install_progress_msg">"Installing %1$s …"</string> <string name="zip_install_progress_msg">"Installing %1$s …"</string>
<string name="no_magisk_title">No Magisk Installed!</string> <string name="no_magisk_title">No Magisk Installed!</string>
<string name="no_magisk_msg">Do you want to download and install Magisk?</string> <string name="no_magisk_msg">Do you want to download and install Magisk?</string>
<string name="root_method_title">Choose a root method</string>
<string name="phh">phh\'s superuser</string>
<string name="supersu">SuperSU</string>
<string name="root_system_msg">It seems that you have incompatible root installed\nDo you want to install Magisk compatible root now?</string>
<!--URL Templates--> <!--URL Templates-->
<string name="url_main">https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=</string> <string name="url_main">https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=</string>
@ -113,20 +111,24 @@
<string name="zip_url">https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip</string> <string name="zip_url">https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip</string>
<!--Settings Fragment --> <!--Settings Fragment -->
<string name="settings_general_category">General</string>
<string name="settings_theme_title">Theme</string>
<string name="settings_theme_summary">Select a theme</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_quicksettings_category">Quick Settings</string> <string name="settings_quicksettings_category">Quick Settings</string>
<string name="settings_enable_quicktile_title">Enable Quicksettings Tile</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_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_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_keep_root_off_title">Keep root turned off</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_root_category">Root</string>
<string name="settings_development_category">Development</string>
<string name="settings_hide_root_notification_summary">When checked, auto-toggle notifications will not be displayed.</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_hide_root_notification_title">Hide auto-toggle notifications</string>
<!--General Use --> <string name="settings_development_category">Development</string>
<string name="toast_error_makedir">Error creating directory, could not download file.</string> <string name="settings_developer_logging_title">Enable advanced debug logging</string>
<string name="toast_error_removing_files">Error removing old files, cancelled.</string> <string name="settings_developer_logging_summary">Check this to enable more verbose logging.</string>
<string name="settings_general_title">General</string>
</resources> </resources>

View File

@ -17,14 +17,6 @@
<item name="ColorNeutral">@color/grey500</item> <item name="ColorNeutral">@color/grey500</item>
</style> </style>
<style name="AppTheme.Toolbar" parent="ThemeOverlay.AppCompat.Light">
<item name="colorPrimary">@color/primary</item>
<item name="android:elevation">4dp</item>
<item name="android:textColorPrimary">@color/primary_text</item>
<item name="android:textColorSecondary">@color/primary_text</item> <!-- force -->
<item name="actionMenuTextColor">@color/icons</item>
</style>
<style name="AppTheme.dh" parent="ThemeOverlay.AppCompat.Dark"> <style name="AppTheme.dh" parent="ThemeOverlay.AppCompat.Dark">
<item name="colorPrimary">@color/dh_primary</item> <item name="colorPrimary">@color/dh_primary</item>
<item name="colorPrimaryDark">@color/dh_primary_dark</item> <item name="colorPrimaryDark">@color/dh_primary_dark</item>

View File

@ -2,16 +2,24 @@
android:layout_marginTop="?attr/actionBarSize" android:layout_marginTop="?attr/actionBarSize"
xmlns:android="http://schemas.android.com/apk/res/android"> xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory <PreferenceCategory
android:title="@string/settings_general_title"> android:title="@string/settings_general_category">
<ListPreference <ListPreference
android:key="theme" android:key="theme"
android:title="Theme" android:title="@string/settings_theme_title"
android:summary="Select a theme" android:summary="@string/settings_theme_summary"
android:defaultValue="Default" android:defaultValue="Default"
android:entries="@array/themes" android:entries="@array/themes"
android:entryValues="@array/themes"/> android:entryValues="@array/themes"/>
<CheckBoxPreference
android:key="busybox"
android:defaultValue="false"
android:title="@string/settings_busybox_title"
android:summary="@string/settings_busybox_summary" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:title="@string/settings_quicksettings_category"> android:title="@string/settings_quicksettings_category">
@ -22,8 +30,10 @@
android:summary="@string/settings_enable_quicktile_summary" /> android:summary="@string/settings_enable_quicktile_summary" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:title="@string/settings_root_category"> android:title="@string/settings_root_category">
<CheckBoxPreference <CheckBoxPreference
android:key="keep_root_off" android:key="keep_root_off"
android:defaultValue="false" android:defaultValue="false"
@ -37,6 +47,7 @@
android:summary="@string/settings_hide_root_notification_summary" /> android:summary="@string/settings_hide_root_notification_summary" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:title="@string/settings_development_category"> android:title="@string/settings_development_category">