Excessive obfuscation when building in release mode

Close #606
This commit is contained in:
topjohnwu 2018-09-14 23:00:39 -04:00
parent 6710314832
commit 78534deab6
50 changed files with 662 additions and 305 deletions

View File

@ -68,10 +68,6 @@ android {
}
}
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
fullImplementation project(':utils')
@ -83,6 +79,4 @@ dependencies {
fullImplementation 'com.github.topjohnwu:libsu:2.0.2'
fullImplementation 'com.atlassian.commonmark:commonmark:0.11.0'
fullImplementation 'org.kamranzafar:jtar:2.3'
fullImplementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
fullAnnotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
}

View File

@ -16,19 +16,20 @@
# public *;
#}
# Don't obfuscate, we are open source anyway :)
-dontobfuscate
# BouncyCastle
-keep class org.bouncycastle.jcajce.provider.asymmetric.rsa.**SHA1** { *; }
-keep class org.bouncycastle.jcajce.provider.asymmetric.RSA** { *; }
-keep class org.bouncycastle.jcajce.provider.digest.SHA1** { *; }
-dontwarn javax.naming.**
# Gson
-keepattributes Signature
# Snet extention
-keepclassmembers class com.topjohnwu.magisk.utils.ISafetyNetHelper { *; }
# Strip logging
-assumenosideeffects class com.topjohnwu.magisk.utils.Logger {
public *** debug(...);
}
# Excessive obfuscation
-repackageclasses 'a'
-allowaccessmodification

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.topjohnwu.magisk">
<uses-permission android:name="android.permission.VIBRATE" />
@ -8,15 +9,18 @@
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:name=".MagiskManager"
android:theme="@style/AppTheme">
android:name="a.a"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<!-- Activities -->
<activity
android:name=".MainActivity"
android:name="a.b"
android:configChanges="orientation|screenSize"
android:exported="true" />
<activity
android:name=".SplashActivity"
android:name="a.c"
android:configChanges="orientation|screenSize"
android:exported="true"
android:theme="@style/SplashTheme">
@ -26,19 +30,22 @@
</intent-filter>
</activity>
<activity
android:name=".AboutActivity"
android:name="a.d"
android:theme="@style/AppTheme.StatusBar" />
<activity
android:name=".DonationActivity"
android:name="a.e"
android:theme="@style/AppTheme.StatusBar"/>
<activity
android:name=".FlashActivity"
android:name="a.f"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="nosensor"
android:theme="@style/AppTheme.StatusBar" />
<activity
android:name=".NoUIActivity"
android:name="a.g"
android:theme="@style/AppTheme.Translucent" />
<!-- Superuser -->
<activity
android:name=".superuser.RequestActivity"
android:excludeFromRecents="true"
@ -47,32 +54,37 @@
android:theme="@style/SuRequest" />
<receiver android:name=".superuser.SuReceiver" />
<receiver android:name=".receivers.BootReceiver">
<!-- Receiver -->
<receiver android:name="a.h">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:name=".receivers.PackageReceiver">
<receiver android:name="a.i">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<action android:name="android.intent.action.PACKAGE_FULLY_REMOVED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
<receiver android:name=".receivers.ManagerUpdate" />
<receiver android:name=".receivers.RebootReceiver" />
<receiver android:name=".receivers.ShortcutReceiver">
<receiver android:name="a.j" />
<receiver android:name="a.k" />
<receiver android:name="a.l">
<intent-filter>
<action android:name="android.intent.action.LOCALE_CHANGED" />
</intent-filter>
</receiver>
<!-- Service -->
<service
android:name=".services.OnBootService"
android:name="a.m"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
<service
android:name=".services.UpdateCheckService"
android:name="a.n"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />

View File

@ -0,0 +1,7 @@
package a;
import com.topjohnwu.magisk.MagiskManager;
public class a extends MagiskManager {
/* stub */
}

View File

@ -0,0 +1,7 @@
package a;
import com.topjohnwu.magisk.MainActivity;
public class b extends MainActivity {
/* stub */
}

View File

@ -0,0 +1,7 @@
package a;
import com.topjohnwu.magisk.SplashActivity;
public class c extends SplashActivity {
/* stub */
}

View File

@ -0,0 +1,7 @@
package a;
import com.topjohnwu.magisk.AboutActivity;
public class d extends AboutActivity {
/* stub */
}

View File

@ -0,0 +1,7 @@
package a;
import com.topjohnwu.magisk.DonationActivity;
public class e extends DonationActivity {
/* stub */
}

View File

@ -0,0 +1,7 @@
package a;
import com.topjohnwu.magisk.FlashActivity;
public class f extends FlashActivity {
/* stub */
}

View File

@ -0,0 +1,7 @@
package a;
import com.topjohnwu.magisk.receivers.BootReceiver;
public class h extends BootReceiver {
/* stub */
}

View File

@ -0,0 +1,7 @@
package a;
import com.topjohnwu.magisk.receivers.PackageReceiver;
public class i extends PackageReceiver {
/* stub */
}

View File

@ -0,0 +1,7 @@
package a;
import com.topjohnwu.magisk.receivers.ManagerUpdate;
public class j extends ManagerUpdate {
/* stub */
}

View File

@ -0,0 +1,7 @@
package a;
import com.topjohnwu.magisk.receivers.RebootReceiver;
public class k extends RebootReceiver {
/* stub */
}

View File

@ -0,0 +1,7 @@
package a;
import com.topjohnwu.magisk.receivers.ShortcutReceiver;
public class l extends ShortcutReceiver {
/* stub */
}

View File

@ -0,0 +1,7 @@
package a;
import com.topjohnwu.magisk.services.OnBootService;
public class m extends OnBootService {
/* stub */
}

View File

@ -0,0 +1,7 @@
package a;
import com.topjohnwu.magisk.services.UpdateCheckService;
public class n extends UpdateCheckService {
/* stub */
}

View File

@ -0,0 +1,22 @@
package a;
import android.content.Context;
import android.util.AttributeSet;
import com.topjohnwu.magisk.components.AboutCardRow;
public class o extends AboutCardRow {
/* stub */
public o(Context context) {
super(context);
}
public o(Context context, AttributeSet attrs) {
super(context, attrs);
}
public o(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
}

View File

@ -15,18 +15,16 @@ import java.util.Locale;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import butterknife.BindView;
import butterknife.ButterKnife;
public class AboutActivity extends BaseActivity {
@BindView(R.id.toolbar) Toolbar toolbar;
@BindView(R.id.app_version_info) AboutCardRow appVersionInfo;
@BindView(R.id.app_changelog) AboutCardRow appChangelog;
@BindView(R.id.app_translators) AboutCardRow appTranslators;
@BindView(R.id.app_source_code) AboutCardRow appSourceCode;
@BindView(R.id.support_thread) AboutCardRow supportThread;
@BindView(R.id.follow_twitter) AboutCardRow twitter;
Toolbar toolbar;
AboutCardRow appVersionInfo;
AboutCardRow appChangelog;
AboutCardRow appTranslators;
AboutCardRow appSourceCode;
AboutCardRow supportThread;
AboutCardRow twitter;
@Override
public int getDarkTheme() {
@ -37,7 +35,7 @@ public class AboutActivity extends BaseActivity {
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
ButterKnife.bind(this);
ViewBinder.bind(this);
setSupportActionBar(toolbar);
toolbar.setNavigationOnClickListener(view -> finish());

View File

@ -10,14 +10,12 @@ import com.topjohnwu.magisk.utils.Utils;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import butterknife.BindView;
import butterknife.ButterKnife;
public class DonationActivity extends BaseActivity {
@BindView(R.id.toolbar) Toolbar toolbar;
@BindView(R.id.paypal) AboutCardRow paypal;
@BindView(R.id.patreon) AboutCardRow patreon;
Toolbar toolbar;
AboutCardRow paypal;
AboutCardRow patreon;
@Override
public int getDarkTheme() {
@ -28,7 +26,7 @@ public class DonationActivity extends BaseActivity {
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_donation);
ButterKnife.bind(this);
ViewBinder.bind(this);
setSupportActionBar(toolbar);
toolbar.setNavigationOnClickListener(view -> finish());

View File

@ -31,31 +31,25 @@ import java.util.Locale;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class FlashActivity extends BaseActivity {
@BindView(R.id.toolbar) Toolbar toolbar;
@BindView(R.id.txtLog) TextView flashLogs;
@BindView(R.id.button_panel) public LinearLayout buttonPanel;
@BindView(R.id.reboot) public Button reboot;
@BindView(R.id.scrollView) ScrollView sv;
Toolbar toolbar;
TextView flashLogs;
public LinearLayout buttonPanel;
public Button reboot;
ScrollView sv;
private List<String> logs;
@OnClick(R.id.no_thanks)
void dismiss() {
finish();
}
@OnClick(R.id.reboot)
void reboot() {
Shell.su("/system/bin/reboot").submit();
}
@OnClick(R.id.save_logs)
void saveLogs() {
runWithPermission(new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, () -> {
Calendar now = Calendar.getInstance();
@ -88,7 +82,7 @@ public class FlashActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_flash);
ButterKnife.bind(this);
ViewBinder.bind(this);
setSupportActionBar(toolbar);
ActionBar ab = getSupportActionBar();
if (ab != null) {

View File

@ -26,8 +26,6 @@ import androidx.appcompat.widget.Toolbar;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import butterknife.BindView;
import butterknife.ButterKnife;
public class MainActivity extends BaseActivity
implements NavigationView.OnNavigationItemSelectedListener, Topic.Subscriber {
@ -36,9 +34,9 @@ public class MainActivity extends BaseActivity
private int mDrawerItem;
private static boolean fromShortcut = false;
@BindView(R.id.drawer_layout) DrawerLayout drawer;
@BindView(R.id.toolbar) public Toolbar toolbar;
@BindView(R.id.nav_view) public NavigationView navigationView;
public Toolbar toolbar;
DrawerLayout drawer;
NavigationView navigationView;
private float toolbarElevation;
@ -50,13 +48,13 @@ public class MainActivity extends BaseActivity
@Override
protected void onCreate(final Bundle savedInstanceState) {
if (!mm.hasInit) {
startActivity(new Intent(this, SplashActivity.class));
startActivity(new Intent(this, a.c.class));
finish();
}
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
ViewBinder.bind(this);
setSupportActionBar(toolbar);
@ -196,11 +194,11 @@ public class MainActivity extends BaseActivity
displayFragment(new SettingsFragment(), true);
break;
case R.id.app_about:
startActivity(new Intent(this, AboutActivity.class));
startActivity(new Intent(this, a.d.class));
mDrawerItem = bak;
break;
case R.id.donation:
startActivity(new Intent(this, DonationActivity.class));
startActivity(new Intent(this, a.e.class));
mDrawerItem = bak;
break;
}

View File

@ -10,12 +10,13 @@ import com.topjohnwu.magisk.asyncs.CheckUpdates;
import com.topjohnwu.magisk.asyncs.UpdateRepos;
import com.topjohnwu.magisk.components.BaseActivity;
import com.topjohnwu.magisk.database.RepoDatabaseHelper;
import com.topjohnwu.magisk.receivers.ShortcutReceiver;
import com.topjohnwu.magisk.utils.Download;
import com.topjohnwu.magisk.utils.LocaleManager;
import com.topjohnwu.magisk.utils.Utils;
import com.topjohnwu.superuser.Shell;
import a.l;
public class SplashActivity extends BaseActivity {
@Override
@ -44,7 +45,7 @@ public class SplashActivity extends BaseActivity {
}
// Setup shortcuts
sendBroadcast(new Intent(this, ShortcutReceiver.class));
sendBroadcast(new Intent(this, l.class));
if (Download.checkNetworkStatus(this)) {
// Fire update check
@ -58,7 +59,7 @@ public class SplashActivity extends BaseActivity {
mm.hasInit = true;
Intent intent = new Intent(this, MainActivity.class);
Intent intent = new Intent(this, a.b.class);
intent.putExtra(Const.Key.OPEN_SECTION, getIntent().getStringExtra(Const.Key.OPEN_SECTION));
intent.putExtra(BaseActivity.INTENT_PERM, getIntent().getStringExtra(BaseActivity.INTENT_PERM));
startActivity(intent);

View File

@ -0,0 +1,292 @@
package com.topjohnwu.magisk;
import android.content.Context;
import android.view.View;
import com.topjohnwu.magisk.adapters.ApplicationAdapter;
import com.topjohnwu.magisk.adapters.ModulesAdapter;
import com.topjohnwu.magisk.adapters.PolicyAdapter;
import com.topjohnwu.magisk.adapters.ReposAdapter;
import com.topjohnwu.magisk.adapters.SuLogAdapter;
import com.topjohnwu.magisk.components.AboutCardRow;
import com.topjohnwu.magisk.components.CustomAlertDialog;
import com.topjohnwu.magisk.fragments.LogFragment;
import com.topjohnwu.magisk.fragments.MagiskFragment;
import com.topjohnwu.magisk.fragments.MagiskHideFragment;
import com.topjohnwu.magisk.fragments.MagiskLogFragment;
import com.topjohnwu.magisk.fragments.ModulesFragment;
import com.topjohnwu.magisk.fragments.ReposFragment;
import com.topjohnwu.magisk.fragments.SuLogFragment;
import com.topjohnwu.magisk.fragments.SuperuserFragment;
import com.topjohnwu.magisk.superuser.RequestActivity;
import androidx.core.content.ContextCompat;
public class ViewBinder {
public static void bind(MainActivity target) {
target.drawer = target.findViewById(R.id.drawer_layout);
target.toolbar = target.findViewById(R.id.toolbar);
target.navigationView = target.findViewById(R.id.nav_view);
}
public static void bind(AboutActivity target) {
target.toolbar = target.findViewById(R.id.toolbar);
target.appVersionInfo = target.findViewById(R.id.app_version_info);
target.appChangelog = target.findViewById(R.id.app_changelog);
target.appTranslators = target.findViewById(R.id.app_translators);
target.appSourceCode = target.findViewById(R.id.app_source_code);
target.supportThread = target.findViewById(R.id.support_thread);
target.twitter = target.findViewById(R.id.follow_twitter);
}
public static void bind(DonationActivity target) {
target.toolbar = target.findViewById(R.id.toolbar);
target.paypal = target.findViewById(R.id.paypal);
target.patreon = target.findViewById(R.id.patreon);
}
public static void bind(FlashActivity target) {
target.toolbar = target.findViewById(R.id.toolbar);
target.flashLogs = target.findViewById(R.id.txtLog);
target.buttonPanel = target.findViewById(R.id.button_panel);
target.findViewById(R.id.no_thanks).setOnClickListener(v -> target.finish());
target.findViewById(R.id.reboot).setOnClickListener(v -> target.reboot());
target.findViewById(R.id.save_logs).setOnClickListener(v -> target.saveLogs());
}
public static void bind(RequestActivity target) {
target.suPopup = target.findViewById(R.id.su_popup);
target.timeout = target.findViewById(R.id.timeout);
target.appIcon = target.findViewById(R.id.app_icon);
target.appNameView = target.findViewById(R.id.app_name);
target.packageNameView = target.findViewById(R.id.package_name);
target.grant_btn = target.findViewById(R.id.grant_btn);
target.deny_btn = target.findViewById(R.id.deny_btn);
target.fingerprintImg = target.findViewById(R.id.fingerprint);
target.warning = target.findViewById(R.id.warning);
}
public static void bind(LogFragment target, View v) {
target.viewPager = v.findViewById(R.id.container);
target.tab = v.findViewById(R.id.tab);
}
public static void unbind(LogFragment target) {
target.viewPager = null;
target.tab = null;
}
public static void bind(MagiskFragment target, View v) {
target.mSwipeRefreshLayout = v.findViewById(R.id.swipeRefreshLayout);
target.coreOnlyNotice = v.findViewById(R.id.core_only_notice);
target.magiskUpdate = v.findViewById(R.id.magisk_update);
target.magiskUpdateIcon = v.findViewById(R.id.magisk_update_icon);
target.magiskUpdateText = v.findViewById(R.id.magisk_update_status);
target.magiskUpdateProgress = v.findViewById(R.id.magisk_update_progress);
target.magiskStatusIcon = v.findViewById(R.id.magisk_status_icon);
target.magiskVersionText = v.findViewById(R.id.magisk_version);
target.safetyNetCard = v.findViewById(R.id.safetyNet_card);
target.safetyNetRefreshIcon = v.findViewById(R.id.safetyNet_refresh);
target.safetyNetStatusText = v.findViewById(R.id.safetyNet_status);
target.safetyNetProgress = v.findViewById(R.id.safetyNet_check_progress);
target.expandLayout = v.findViewById(R.id.expand_layout);
target.ctsStatusIcon = v.findViewById(R.id.cts_status_icon);
target.ctsStatusText = v.findViewById(R.id.cts_status);
target.basicStatusIcon = v.findViewById(R.id.basic_status_icon);
target.basicStatusText = v.findViewById(R.id.basic_status);
target.installOptionCard = v.findViewById(R.id.install_option_card);
target.keepEncChkbox = v.findViewById(R.id.keep_force_enc);
target.keepVerityChkbox = v.findViewById(R.id.keep_verity);
target.installButton = v.findViewById(R.id.install_button);
target.installText = v.findViewById(R.id.install_text);
target.uninstallButton = v.findViewById(R.id.uninstall_button);
v.findViewById(R.id.safetyNet_title).setOnClickListener(v1 -> target.safetyNet());
v.findViewById(R.id.install_button).setOnClickListener(v1 -> target.install());
v.findViewById(R.id.uninstall_button).setOnClickListener(v1 -> target.uninstall());
Context ctx = target.getContext();
target.colorBad = ContextCompat.getColor(ctx, R.color.red500);
target.colorOK = ContextCompat.getColor(ctx, R.color.green500);
target.colorWarn = ContextCompat.getColor(ctx, R.color.yellow500);
target.colorNeutral = ContextCompat.getColor(ctx, R.color.grey500);
target.colorInfo = ContextCompat.getColor(ctx, R.color.blue500);
}
public static void unbind(MagiskFragment target) {
target.mSwipeRefreshLayout = null;
target.coreOnlyNotice = null;
target.magiskUpdate = null;
target.magiskUpdateIcon = null;
target.magiskUpdateText = null;
target.magiskUpdateProgress = null;
target.magiskStatusIcon = null;
target.magiskVersionText = null;
target.safetyNetCard = null;
target.safetyNetRefreshIcon = null;
target.safetyNetStatusText = null;
target.safetyNetProgress = null;
target.expandLayout = null;
target.ctsStatusIcon = null;
target.ctsStatusText = null;
target.basicStatusIcon = null;
target.basicStatusText = null;
target.installOptionCard = null;
target.keepEncChkbox = null;
target.keepVerityChkbox = null;
target.installButton = null;
target.installText = null;
target.uninstallButton = null;
View v = target.getView();
v.findViewById(R.id.safetyNet_title).setOnClickListener(null);
v.findViewById(R.id.install_button).setOnClickListener(null);
v.findViewById(R.id.uninstall_button).setOnClickListener(null);
}
public static void bind(MagiskHideFragment target, View v) {
target.mSwipeRefreshLayout = v.findViewById(R.id.swipeRefreshLayout);
target.recyclerView = v.findViewById(R.id.recyclerView);
}
public static void unbind(MagiskHideFragment target) {
target.mSwipeRefreshLayout = null;
target.recyclerView = null;
}
public static void bind(MagiskLogFragment target, View v) {
target.txtLog = v.findViewById(R.id.txtLog);
target.svLog = v.findViewById(R.id.svLog);
target.hsvLog = v.findViewById(R.id.hsvLog);
target.progressBar = v.findViewById(R.id.progressBar);
}
public static void unbind(MagiskLogFragment target) {
target.txtLog = null;
target.svLog = null;
target.hsvLog = null;
target.progressBar = null;
}
public static void bind(ModulesFragment target, View v) {
target.mSwipeRefreshLayout = v.findViewById(R.id.swipeRefreshLayout);
target.recyclerView = v.findViewById(R.id.recyclerView);
target.emptyRv = v.findViewById(R.id.empty_rv);
v.findViewById(R.id.fab).setOnClickListener(v1 -> target.selectFile());
}
public static void unbind(ModulesFragment target) {
target.mSwipeRefreshLayout = null;
target.recyclerView = null;
target.emptyRv = null;
View v = target.getView();
v.findViewById(R.id.fab).setOnClickListener(null);
}
public static void bind(ReposFragment target, View source) {
target.recyclerView = source.findViewById(R.id.recyclerView);
target.emptyRv = source.findViewById(R.id.empty_rv);
target.mSwipeRefreshLayout = source.findViewById(R.id.swipeRefreshLayout);
}
public static void unbind(ReposFragment target) {
target.recyclerView = null;
target.emptyRv = null;
target.mSwipeRefreshLayout = null;
}
public static void bind(SuLogFragment target, View source) {
target.emptyRv = source.findViewById(R.id.empty_rv);
target.recyclerView = source.findViewById(R.id.recyclerView);
}
public static void unbind(SuLogFragment target) {
target.emptyRv = null;
target.recyclerView = null;
}
public static void bind(SuperuserFragment target, View source) {
target.recyclerView = source.findViewById(R.id.recyclerView);
target.emptyRv = source.findViewById(R.id.empty_rv);
}
public static void unbind(SuperuserFragment target) {
target.emptyRv = null;
target.recyclerView = null;
}
public static void bind(CustomAlertDialog.ViewHolder target, View source) {
target.dialogLayout = source.findViewById(R.id.dialog_layout);
target.buttons = source.findViewById(R.id.button_panel);
target.messageView = source.findViewById(R.id.message);
target.negative = source.findViewById(R.id.negative);
target.positive = source.findViewById(R.id.positive);
target.neutral = source.findViewById(R.id.neutral);
}
public static void bind(AboutCardRow target, View source) {
target.mTitle = source.findViewById(android.R.id.title);
target.mSummary = source.findViewById(android.R.id.summary);
target.mIcon = source.findViewById(android.R.id.icon);
target.mView = source.findViewById(R.id.container);
}
public static void bind(ApplicationAdapter.ViewHolder target, View source) {
target.appIcon = source.findViewById(R.id.app_icon);
target.appName = source.findViewById(R.id.app_name);
target.appPackage = source.findViewById(R.id.package_name);
target.checkBox = source.findViewById(R.id.checkbox);
}
public static void bind(ModulesAdapter.ViewHolder target, View source) {
target.title = source.findViewById(R.id.title);
target.versionName = source.findViewById(R.id.version_name);
target.description = source.findViewById(R.id.description);
target.notice = source.findViewById(R.id.notice);
target.checkBox = source.findViewById(R.id.checkbox);
target.author = source.findViewById(R.id.author);
target.delete = source.findViewById(R.id.delete);
}
public static void bind(PolicyAdapter.ViewHolder target, View source) {
target.appName = source.findViewById(R.id.app_name);
target.packageName = source.findViewById(R.id.package_name);
target.appIcon = source.findViewById(R.id.app_icon);
target.masterSwitch = source.findViewById(R.id.master_switch);
target.notificationSwitch = source.findViewById(R.id.notification_switch);
target.loggingSwitch = source.findViewById(R.id.logging_switch);
target.expandLayout = source.findViewById(R.id.expand_layout);
target.delete = source.findViewById(R.id.delete);
target.moreInfo = source.findViewById(R.id.more_info);
}
public static void bind(ReposAdapter.SectionHolder target, View source) {
target.sectionText = source.findViewById(R.id.section_text);
}
public static void bind(ReposAdapter.RepoHolder target, View source) {
target.title = source.findViewById(R.id.title);
target.versionName = source.findViewById(R.id.version_name);
target.description = source.findViewById(R.id.description);
target.author = source.findViewById(R.id.author);
target.infoLayout = source.findViewById(R.id.info_layout);
target.downloadImage = source.findViewById(R.id.download);
target.updateTime = source.findViewById(R.id.update_time);
}
public static void bind(SuLogAdapter.SectionHolder target, View source) {
target.date = source.findViewById(R.id.date);
target.arrow = source.findViewById(R.id.arrow);
}
public static void bind(SuLogAdapter.LogViewHolder target, View source) {
target.appName = source.findViewById(R.id.app_name);
target.action = source.findViewById(R.id.action);
target.time = source.findViewById(R.id.time);
target.fromPid = source.findViewById(R.id.fromPid);
target.toUid = source.findViewById(R.id.toUid);
target.command = source.findViewById(R.id.command);
target.expandLayout = source.findViewById(R.id.expand_layout);
}
}

View File

@ -17,6 +17,7 @@ import android.widget.TextView;
import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ViewBinder;
import com.topjohnwu.magisk.utils.LocaleManager;
import com.topjohnwu.magisk.utils.Topic;
import com.topjohnwu.superuser.Shell;
@ -28,8 +29,6 @@ import java.util.List;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.ViewHolder> {
@ -123,16 +122,16 @@ public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.
AsyncTask.THREAD_POOL_EXECUTOR.execute(this::loadApps);
}
static class ViewHolder extends RecyclerView.ViewHolder {
public static class ViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.app_icon) ImageView appIcon;
@BindView(R.id.app_name) TextView appName;
@BindView(R.id.package_name) TextView appPackage;
@BindView(R.id.checkbox) CheckBox checkBox;
public ImageView appIcon;
public TextView appName;
public TextView appPackage;
public CheckBox checkBox;
ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
ViewBinder.bind(this, itemView);
}
}

View File

@ -11,6 +11,7 @@ import android.widget.TextView;
import com.google.android.material.snackbar.Snackbar;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ViewBinder;
import com.topjohnwu.magisk.components.SnackbarMaker;
import com.topjohnwu.magisk.container.Module;
import com.topjohnwu.superuser.Shell;
@ -18,8 +19,6 @@ import com.topjohnwu.superuser.Shell;
import java.util.List;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHolder> {
@ -102,19 +101,19 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
return mList.size();
}
static class ViewHolder extends RecyclerView.ViewHolder {
public static class ViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.title) TextView title;
@BindView(R.id.version_name) TextView versionName;
@BindView(R.id.description) TextView description;
@BindView(R.id.notice) TextView notice;
@BindView(R.id.checkbox) CheckBox checkBox;
@BindView(R.id.author) TextView author;
@BindView(R.id.delete) ImageView delete;
public TextView title;
public TextView versionName;
public TextView description;
public TextView notice;
public CheckBox checkBox;
public TextView author;
public ImageView delete;
ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
ViewBinder.bind(this, itemView);
if (!Shell.rootAccess()) {
checkBox.setEnabled(false);

View File

@ -11,6 +11,7 @@ import android.widget.TextView;
import com.google.android.material.snackbar.Snackbar;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ViewBinder;
import com.topjohnwu.magisk.components.CustomAlertDialog;
import com.topjohnwu.magisk.components.ExpandableView;
import com.topjohnwu.magisk.components.SnackbarMaker;
@ -22,8 +23,6 @@ import java.util.List;
import java.util.Set;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder> {
@ -120,24 +119,24 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
return policyList.size();
}
static class ViewHolder extends RecyclerView.ViewHolder implements ExpandableView {
public static class ViewHolder extends RecyclerView.ViewHolder implements ExpandableView {
@BindView(R.id.app_name) TextView appName;
@BindView(R.id.package_name) TextView packageName;
@BindView(R.id.app_icon) ImageView appIcon;
@BindView(R.id.master_switch) Switch masterSwitch;
@BindView(R.id.notification_switch) Switch notificationSwitch;
@BindView(R.id.logging_switch) Switch loggingSwitch;
@BindView(R.id.expand_layout) ViewGroup expandLayout;
public TextView appName;
public TextView packageName;
public ImageView appIcon;
public Switch masterSwitch;
public Switch notificationSwitch;
public Switch loggingSwitch;
public ViewGroup expandLayout;
@BindView(R.id.delete) ImageView delete;
@BindView(R.id.more_info) ImageView moreInfo;
public ImageView delete;
public ImageView moreInfo;
private Container container = new Container();
public ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
ViewBinder.bind(this, itemView);
container.expandLayout = expandLayout;
setupExpandable();
}

View File

@ -12,6 +12,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ViewBinder;
import com.topjohnwu.magisk.asyncs.MarkDownWindow;
import com.topjohnwu.magisk.asyncs.ProcessRepoZip;
import com.topjohnwu.magisk.components.BaseActivity;
@ -25,8 +26,6 @@ import java.util.List;
import java.util.Map;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
public class ReposAdapter extends SectionedAdapter<ReposAdapter.SectionHolder, ReposAdapter.RepoHolder> {
@ -159,29 +158,29 @@ public class ReposAdapter extends SectionedAdapter<ReposAdapter.SectionHolder, R
notifyDataSetChanged();
}
static class SectionHolder extends RecyclerView.ViewHolder {
public static class SectionHolder extends RecyclerView.ViewHolder {
@BindView(R.id.section_text) TextView sectionText;
public TextView sectionText;
SectionHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
ViewBinder.bind(this, itemView);
}
}
static class RepoHolder extends RecyclerView.ViewHolder {
public static class RepoHolder extends RecyclerView.ViewHolder {
@BindView(R.id.title) TextView title;
@BindView(R.id.version_name) TextView versionName;
@BindView(R.id.description) TextView description;
@BindView(R.id.author) TextView author;
@BindView(R.id.info_layout) LinearLayout infoLayout;
@BindView(R.id.download) ImageView downloadImage;
@BindView(R.id.update_time) TextView updateTime;
public TextView title;
public TextView versionName;
public TextView description;
public TextView author;
public LinearLayout infoLayout;
public ImageView downloadImage;
public TextView updateTime;
RepoHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
ViewBinder.bind(this, itemView);
}
}

View File

@ -10,6 +10,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ViewBinder;
import com.topjohnwu.magisk.components.ExpandableView;
import com.topjohnwu.magisk.container.SuLogEntry;
import com.topjohnwu.magisk.database.MagiskDatabaseHelper;
@ -20,8 +21,6 @@ import java.util.List;
import java.util.Set;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
public class SuLogAdapter extends SectionedAdapter<SuLogAdapter.SectionHolder, SuLogAdapter.LogViewHolder> {
@ -117,32 +116,32 @@ public class SuLogAdapter extends SectionedAdapter<SuLogAdapter.SectionHolder, S
notifyDataSetChanged();
}
static class SectionHolder extends RecyclerView.ViewHolder {
public static class SectionHolder extends RecyclerView.ViewHolder {
@BindView(R.id.date) TextView date;
@BindView(R.id.arrow) ImageView arrow;
public TextView date;
public ImageView arrow;
SectionHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
ViewBinder.bind(this, itemView);
}
}
static class LogViewHolder extends RecyclerView.ViewHolder implements ExpandableView {
public static class LogViewHolder extends RecyclerView.ViewHolder implements ExpandableView {
@BindView(R.id.app_name) TextView appName;
@BindView(R.id.action) TextView action;
@BindView(R.id.time) TextView time;
@BindView(R.id.fromPid) TextView fromPid;
@BindView(R.id.toUid) TextView toUid;
@BindView(R.id.command) TextView command;
@BindView(R.id.expand_layout) ViewGroup expandLayout;
public TextView appName;
public TextView action;
public TextView time;
public TextView fromPid;
public TextView toUid;
public TextView command;
public ViewGroup expandLayout;
private Container container = new Container();
LogViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
ViewBinder.bind(this, itemView);
container.expandLayout = expandLayout;
setupExpandable();
}

View File

@ -27,19 +27,17 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.topjohnwu.magisk.R;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.topjohnwu.magisk.ViewBinder;
/**
* @author dvdandroid
*/
public class AboutCardRow extends LinearLayout {
@BindView(android.R.id.title) TextView mTitle;
@BindView(android.R.id.summary) TextView mSummary;
@BindView(android.R.id.icon) ImageView mIcon;
@BindView(R.id.container) View mView;
public TextView mTitle;
public TextView mSummary;
public ImageView mIcon;
public View mView;
public AboutCardRow(Context context) {
this(context, null);
@ -52,7 +50,7 @@ public class AboutCardRow extends LinearLayout {
public AboutCardRow(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
LayoutInflater.from(context).inflate(R.layout.info_item_row, this);
ButterKnife.bind(this, this);
ViewBinder.bind(this, this);
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.AboutCardRow, 0, 0);
String title;
@ -69,8 +67,6 @@ public class AboutCardRow extends LinearLayout {
@Override
public void setOnClickListener(OnClickListener l) {
super.setOnClickListener(l);
mView.setOnClickListener(l);
}

View File

@ -9,14 +9,13 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ViewBinder;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.annotation.StyleRes;
import androidx.appcompat.app.AlertDialog;
import butterknife.BindView;
import butterknife.ButterKnife;
public class CustomAlertDialog extends AlertDialog.Builder {
@ -28,16 +27,16 @@ public class CustomAlertDialog extends AlertDialog.Builder {
private ViewHolder vh;
public class ViewHolder {
@BindView(R.id.dialog_layout) public LinearLayout dialogLayout;
@BindView(R.id.button_panel) public LinearLayout buttons;
public LinearLayout dialogLayout;
public LinearLayout buttons;
@BindView(R.id.message) public TextView messageView;
@BindView(R.id.negative) public Button negative;
@BindView(R.id.positive) public Button positive;
@BindView(R.id.neutral) public Button neutral;
public TextView messageView;
public Button negative;
public Button positive;
public Button neutral;
ViewHolder(View v) {
ButterKnife.bind(this, v);
ViewBinder.bind(this, v);
messageView.setVisibility(View.GONE);
negative.setVisibility(View.GONE);
positive.setVisibility(View.GONE);

View File

@ -9,9 +9,9 @@ import com.topjohnwu.magisk.Data;
import com.topjohnwu.magisk.MagiskManager;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.asyncs.MarkDownWindow;
import com.topjohnwu.magisk.receivers.ManagerUpdate;
import com.topjohnwu.magisk.utils.Utils;
import a.j;
import androidx.annotation.NonNull;
public class ManagerInstallDialog extends CustomAlertDialog {
@ -26,7 +26,7 @@ public class ManagerInstallDialog extends CustomAlertDialog {
setCancelable(true);
setPositiveButton(R.string.install, (d, i) -> activity.runWithPermission(
new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, () -> {
Intent intent = new Intent(mm, ManagerUpdate.class);
Intent intent = new Intent(mm, j.class);
intent.putExtra(Const.Key.INTENT_SET_LINK, Data.managerLink);
intent.putExtra(Const.Key.INTENT_SET_FILENAME, filename);
mm.sendBroadcast(intent);

View File

@ -11,27 +11,23 @@ import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.Data;
import com.topjohnwu.magisk.MainActivity;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ViewBinder;
import com.topjohnwu.magisk.adapters.TabFragmentAdapter;
import com.topjohnwu.magisk.components.BaseFragment;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
public class LogFragment extends BaseFragment {
private Unbinder unbinder;
@BindView(R.id.container) ViewPager viewPager;
@BindView(R.id.tab) TabLayout tab;
public ViewPager viewPager;
public TabLayout tab;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_log, container, false);
unbinder = ButterKnife.bind(this, v);
ViewBinder.bind(this, v);
((MainActivity) requireActivity()).toolbar.setElevation(0);
@ -52,7 +48,6 @@ public class LogFragment extends BaseFragment {
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
ViewBinder.unbind(this);
}
}

View File

@ -20,6 +20,7 @@ import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.Data;
import com.topjohnwu.magisk.MainActivity;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ViewBinder;
import com.topjohnwu.magisk.asyncs.CheckSafetyNet;
import com.topjohnwu.magisk.asyncs.CheckUpdates;
import com.topjohnwu.magisk.components.BaseActivity;
@ -41,55 +42,48 @@ import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.cardview.widget.CardView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import butterknife.BindColor;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
public class MagiskFragment extends BaseFragment
implements SwipeRefreshLayout.OnRefreshListener, ExpandableView, Topic.Subscriber {
private Container expandableContainer = new Container();
private Unbinder unbinder;
private static boolean shownDialog = false;
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
public SwipeRefreshLayout mSwipeRefreshLayout;
@BindView(R.id.core_only_notice) CardView coreOnlyNotice;
public CardView coreOnlyNotice;
@BindView(R.id.magisk_update) RelativeLayout magiskUpdate;
@BindView(R.id.magisk_update_icon) ImageView magiskUpdateIcon;
@BindView(R.id.magisk_update_status) TextView magiskUpdateText;
@BindView(R.id.magisk_update_progress) ProgressBar magiskUpdateProgress;
@BindView(R.id.magisk_status_icon) ImageView magiskStatusIcon;
@BindView(R.id.magisk_version) TextView magiskVersionText;
public RelativeLayout magiskUpdate;
public ImageView magiskUpdateIcon;
public TextView magiskUpdateText;
public ProgressBar magiskUpdateProgress;
public ImageView magiskStatusIcon;
public TextView magiskVersionText;
@BindView(R.id.safetyNet_card) CardView safetyNetCard;
@BindView(R.id.safetyNet_refresh) ImageView safetyNetRefreshIcon;
@BindView(R.id.safetyNet_status) TextView safetyNetStatusText;
@BindView(R.id.safetyNet_check_progress) ProgressBar safetyNetProgress;
@BindView(R.id.expand_layout) LinearLayout expandLayout;
@BindView(R.id.cts_status_icon) ImageView ctsStatusIcon;
@BindView(R.id.cts_status) TextView ctsStatusText;
@BindView(R.id.basic_status_icon) ImageView basicStatusIcon;
@BindView(R.id.basic_status) TextView basicStatusText;
public CardView safetyNetCard;
public ImageView safetyNetRefreshIcon;
public TextView safetyNetStatusText;
public ProgressBar safetyNetProgress;
public LinearLayout expandLayout;
public ImageView ctsStatusIcon;
public TextView ctsStatusText;
public ImageView basicStatusIcon;
public TextView basicStatusText;
@BindView(R.id.install_option_card) CardView installOptionCard;
@BindView(R.id.keep_force_enc) CheckBox keepEncChkbox;
@BindView(R.id.keep_verity) CheckBox keepVerityChkbox;
@BindView(R.id.install_button) CardView installButton;
@BindView(R.id.install_text) TextView installText;
@BindView(R.id.uninstall_button) CardView uninstallButton;
public CardView installOptionCard;
public CheckBox keepEncChkbox;
public CheckBox keepVerityChkbox;
public CardView installButton;
public TextView installText;
public CardView uninstallButton;
@BindColor(R.color.red500) int colorBad;
@BindColor(R.color.green500) int colorOK;
@BindColor(R.color.yellow500) int colorWarn;
@BindColor(R.color.grey500) int colorNeutral;
@BindColor(R.color.blue500) int colorInfo;
public int colorBad;
public int colorOK;
public int colorWarn;
public int colorNeutral;
public int colorInfo;
@OnClick(R.id.safetyNet_title)
void safetyNet() {
public void safetyNet() {
Runnable task = () -> {
safetyNetProgress.setVisibility(View.VISIBLE);
safetyNetRefreshIcon.setVisibility(View.GONE);
@ -112,8 +106,7 @@ public class MagiskFragment extends BaseFragment
}
@OnClick(R.id.install_button)
void install() {
public void install() {
shownDialog = true;
// Show Manager update first
@ -126,8 +119,7 @@ public class MagiskFragment extends BaseFragment
new MagiskInstallDialog((BaseActivity) getActivity()).show();
}
@OnClick(R.id.uninstall_button)
void uninstall() {
public void uninstall() {
new UninstallDialog(requireActivity()).show();
}
@ -136,7 +128,7 @@ public class MagiskFragment extends BaseFragment
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_magisk, container, false);
unbinder = ButterKnife.bind(this, v);
ViewBinder.bind(this, v);
requireActivity().setTitle(R.string.magisk);
expandableContainer.expandLayout = expandLayout;
@ -153,6 +145,12 @@ public class MagiskFragment extends BaseFragment
return v;
}
@Override
public void onDestroyView() {
super.onDestroyView();
ViewBinder.unbind(this);
}
@Override
public void onRefresh() {
Data.loadMagiskInfo();
@ -196,12 +194,6 @@ public class MagiskFragment extends BaseFragment
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
}
@Override
public Container getContainer() {
return expandableContainer;

View File

@ -9,6 +9,7 @@ import android.view.ViewGroup;
import android.widget.SearchView;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ViewBinder;
import com.topjohnwu.magisk.adapters.ApplicationAdapter;
import com.topjohnwu.magisk.components.BaseFragment;
import com.topjohnwu.magisk.utils.Topic;
@ -17,15 +18,11 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
public class MagiskHideFragment extends BaseFragment implements Topic.Subscriber {
private Unbinder unbinder;
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
@BindView(R.id.recyclerView) RecyclerView recyclerView;
public SwipeRefreshLayout mSwipeRefreshLayout;
public RecyclerView recyclerView;
SearchView search;
private ApplicationAdapter appAdapter;
@ -42,7 +39,7 @@ public class MagiskHideFragment extends BaseFragment implements Topic.Subscriber
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_magisk_hide, container, false);
unbinder = ButterKnife.bind(this, view);
ViewBinder.bind(this, view);
appAdapter = new ApplicationAdapter(requireActivity());
recyclerView.setAdapter(appAdapter);
@ -79,7 +76,7 @@ public class MagiskHideFragment extends BaseFragment implements Topic.Subscriber
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
ViewBinder.unbind(this);
}
@Override

View File

@ -17,6 +17,7 @@ import android.widget.TextView;
import com.google.android.material.snackbar.Snackbar;
import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ViewBinder;
import com.topjohnwu.magisk.components.BaseFragment;
import com.topjohnwu.magisk.components.SnackbarMaker;
import com.topjohnwu.magisk.utils.Download;
@ -28,24 +29,19 @@ import java.io.IOException;
import java.util.Calendar;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
public class MagiskLogFragment extends BaseFragment {
private Unbinder unbinder;
@BindView(R.id.txtLog) TextView txtLog;
@BindView(R.id.svLog) ScrollView svLog;
@BindView(R.id.hsvLog) HorizontalScrollView hsvLog;
@BindView(R.id.progressBar) ProgressBar progressBar;
public TextView txtLog;
public ScrollView svLog;
public HorizontalScrollView hsvLog;
public ProgressBar progressBar;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_magisk_log, container, false);
unbinder = ButterKnife.bind(this, view);
ViewBinder.bind(this, view);
setHasOptionsMenu(true);
txtLog.setTextIsSelectable(true);
return view;
@ -66,7 +62,7 @@ public class MagiskLogFragment extends BaseFragment {
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
ViewBinder.unbind(this);
}
@Override

View File

@ -15,6 +15,7 @@ import android.widget.TextView;
import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.FlashActivity;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ViewBinder;
import com.topjohnwu.magisk.adapters.ModulesAdapter;
import com.topjohnwu.magisk.components.BaseFragment;
import com.topjohnwu.magisk.container.Module;
@ -30,18 +31,13 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
public class ModulesFragment extends BaseFragment implements Topic.Subscriber {
private Unbinder unbinder;
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
@BindView(R.id.recyclerView) RecyclerView recyclerView;
@BindView(R.id.empty_rv) TextView emptyRv;
@OnClick(R.id.fab)
public SwipeRefreshLayout mSwipeRefreshLayout;
public RecyclerView recyclerView;
public TextView emptyRv;
public void selectFile() {
runWithPermission(new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, () -> {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
@ -56,7 +52,7 @@ public class ModulesFragment extends BaseFragment implements Topic.Subscriber {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_modules, container, false);
unbinder = ButterKnife.bind(this, view);
ViewBinder.bind(this, view);
setHasOptionsMenu(true);
mSwipeRefreshLayout.setOnRefreshListener(() -> {
@ -104,7 +100,7 @@ public class ModulesFragment extends BaseFragment implements Topic.Subscriber {
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
ViewBinder.unbind(this);
}
@Override

View File

@ -14,6 +14,7 @@ import android.widget.TextView;
import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.Data;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ViewBinder;
import com.topjohnwu.magisk.adapters.ReposAdapter;
import com.topjohnwu.magisk.asyncs.UpdateRepos;
import com.topjohnwu.magisk.components.BaseFragment;
@ -26,16 +27,12 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
public class ReposFragment extends BaseFragment implements Topic.Subscriber {
private Unbinder unbinder;
@BindView(R.id.recyclerView) RecyclerView recyclerView;
@BindView(R.id.empty_rv) TextView emptyRv;
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
public RecyclerView recyclerView;
public TextView emptyRv;
public SwipeRefreshLayout mSwipeRefreshLayout;
private ReposAdapter adapter;
@ -49,7 +46,7 @@ public class ReposFragment extends BaseFragment implements Topic.Subscriber {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_repos, container, false);
unbinder = ButterKnife.bind(this, view);
ViewBinder.bind(this, view);
mSwipeRefreshLayout.setRefreshing(true);
recyclerView.setVisibility(View.GONE);
@ -123,6 +120,6 @@ public class ReposFragment extends BaseFragment implements Topic.Subscriber {
public void onDestroyView() {
super.onDestroyView();
mm.repoDB.unregisterAdapter();
unbinder.unbind();
ViewBinder.unbind(this);
}
}

View File

@ -10,21 +10,18 @@ import android.view.ViewGroup;
import android.widget.TextView;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ViewBinder;
import com.topjohnwu.magisk.adapters.SuLogAdapter;
import com.topjohnwu.magisk.components.BaseFragment;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
public class SuLogFragment extends BaseFragment {
@BindView(R.id.empty_rv) TextView emptyRv;
@BindView(R.id.recyclerView) RecyclerView recyclerView;
public TextView emptyRv;
public RecyclerView recyclerView;
private Unbinder unbinder;
private SuLogAdapter adapter;
@Override
@ -44,7 +41,7 @@ public class SuLogFragment extends BaseFragment {
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_su_log, container, false);
unbinder = ButterKnife.bind(this, v);
ViewBinder.bind(this, v);
adapter = new SuLogAdapter(mm.mDB);
recyclerView.setAdapter(adapter);
@ -83,6 +80,6 @@ public class SuLogFragment extends BaseFragment {
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
ViewBinder.unbind(this);
}
}

View File

@ -8,6 +8,7 @@ import android.view.ViewGroup;
import android.widget.TextView;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ViewBinder;
import com.topjohnwu.magisk.adapters.PolicyAdapter;
import com.topjohnwu.magisk.components.BaseFragment;
import com.topjohnwu.magisk.container.Policy;
@ -16,22 +17,19 @@ import java.util.List;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
public class SuperuserFragment extends BaseFragment {
private Unbinder unbinder;
public RecyclerView recyclerView;
public TextView emptyRv;
private PackageManager pm;
@BindView(R.id.recyclerView) RecyclerView recyclerView;
@BindView(R.id.empty_rv) TextView emptyRv;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_superuser, container, false);
unbinder = ButterKnife.bind(this, view);
ViewBinder.bind(this, view);
pm = getActivity().getPackageManager();
return view;
@ -52,7 +50,7 @@ public class SuperuserFragment extends BaseFragment {
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
ViewBinder.unbind(this);
}
private void displayPolicyList() {

View File

@ -5,14 +5,14 @@ import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.topjohnwu.magisk.services.OnBootService;
import a.m;
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (TextUtils.equals(intent.getAction(), Intent.ACTION_BOOT_COMPLETED))
OnBootService.enqueueWork(context);
m.enqueueWork(context);
}
}

View File

@ -12,7 +12,6 @@ import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.Data;
import com.topjohnwu.magisk.MagiskManager;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.SplashActivity;
import com.topjohnwu.superuser.Shell;
import java.util.ArrayList;
@ -37,7 +36,7 @@ public class ShortcutReceiver extends BroadcastReceiver {
Data.multiuserMode == Const.Value.MULTIUSER_MODE_OWNER_MANAGED)) {
shortCuts.add(new ShortcutInfo.Builder(mm, "superuser")
.setShortLabel(mm.getString(R.string.superuser))
.setIntent(new Intent(mm, SplashActivity.class)
.setIntent(new Intent(mm, a.c.class)
.putExtra(Const.Key.OPEN_SECTION, "superuser")
.setAction(Intent.ACTION_VIEW)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK))
@ -49,7 +48,7 @@ public class ShortcutReceiver extends BroadcastReceiver {
&& mm.prefs.getBoolean(Const.Key.MAGISKHIDE, false)) {
shortCuts.add(new ShortcutInfo.Builder(mm, "magiskhide")
.setShortLabel(mm.getString(R.string.magiskhide))
.setIntent(new Intent(mm, SplashActivity.class)
.setIntent(new Intent(mm, a.c.class)
.putExtra(Const.Key.OPEN_SECTION, "magiskhide")
.setAction(Intent.ACTION_VIEW)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK))
@ -60,7 +59,7 @@ public class ShortcutReceiver extends BroadcastReceiver {
if (!mm.prefs.getBoolean(Const.Key.COREONLY, false) && root && Data.magiskVersionCode >= 0) {
shortCuts.add(new ShortcutInfo.Builder(mm, "modules")
.setShortLabel(mm.getString(R.string.modules))
.setIntent(new Intent(mm, SplashActivity.class)
.setIntent(new Intent(mm, a.c.class)
.putExtra(Const.Key.OPEN_SECTION, "modules")
.setAction(Intent.ACTION_VIEW)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK))
@ -69,7 +68,7 @@ public class ShortcutReceiver extends BroadcastReceiver {
.build());
shortCuts.add(new ShortcutInfo.Builder(mm, "downloads")
.setShortLabel(mm.getString(R.string.download))
.setIntent(new Intent(mm, SplashActivity.class)
.setIntent(new Intent(mm, a.c.class)
.putExtra(Const.Key.OPEN_SECTION, "downloads")
.setAction(Intent.ACTION_VIEW)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK))

View File

@ -22,6 +22,7 @@ import android.widget.TextView;
import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.Data;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ViewBinder;
import com.topjohnwu.magisk.asyncs.ParallelTask;
import com.topjohnwu.magisk.components.BaseActivity;
import com.topjohnwu.magisk.container.Policy;
@ -30,20 +31,17 @@ import com.topjohnwu.magisk.utils.FingerprintHelper;
import java.io.DataInputStream;
import java.io.IOException;
import butterknife.BindView;
import butterknife.ButterKnife;
public class RequestActivity extends BaseActivity {
@BindView(R.id.su_popup) LinearLayout suPopup;
@BindView(R.id.timeout) Spinner timeout;
@BindView(R.id.app_icon) ImageView appIcon;
@BindView(R.id.app_name) TextView appNameView;
@BindView(R.id.package_name) TextView packageNameView;
@BindView(R.id.grant_btn) Button grant_btn;
@BindView(R.id.deny_btn) Button deny_btn;
@BindView(R.id.fingerprint) ImageView fingerprintImg;
@BindView(R.id.warning) TextView warning;
public LinearLayout suPopup;
public Spinner timeout;
public ImageView appIcon;
public TextView appNameView;
public TextView packageNameView;
public Button grant_btn;
public Button deny_btn;
public ImageView fingerprintImg;
public TextView warning;
private String socketPath;
private LocalSocket socket;
@ -117,7 +115,7 @@ public class RequestActivity extends BaseActivity {
}
setContentView(R.layout.activity_request);
ButterKnife.bind(this);
ViewBinder.bind(this);
appIcon.setImageDrawable(policy.info.loadIcon(pm));
appNameView.setText(policy.appName);

View File

@ -1,7 +1,5 @@
package com.topjohnwu.magisk.utils;
import androidx.annotation.Keep;
public interface ISafetyNetHelper {
int RESPONSE_ERR = 0x01;
@ -10,14 +8,11 @@ public interface ISafetyNetHelper {
int BASIC_PASS = 0x10;
int CTS_PASS = 0x20;
@Keep
void attest();
@Keep
int getVersion();
interface Callback {
@Keep
void onResponse(int responseCode);
}
}

View File

@ -9,10 +9,9 @@ import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.Data;
import com.topjohnwu.magisk.MagiskManager;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.SplashActivity;
import com.topjohnwu.magisk.receivers.ManagerUpdate;
import com.topjohnwu.magisk.receivers.RebootReceiver;
import a.j;
import a.k;
import androidx.core.app.NotificationCompat;
import androidx.core.app.TaskStackBuilder;
@ -21,10 +20,10 @@ public class NotificationMgr {
public static void magiskUpdate() {
MagiskManager mm = Data.MM();
Intent intent = new Intent(mm, SplashActivity.class);
Intent intent = new Intent(mm, a.c.class);
intent.putExtra(Const.Key.OPEN_SECTION, "magisk");
TaskStackBuilder stackBuilder = TaskStackBuilder.create(mm);
stackBuilder.addParentStack(SplashActivity.class);
stackBuilder.addParentStack(a.c.class);
stackBuilder.addNextIntent(intent);
PendingIntent pendingIntent = stackBuilder.getPendingIntent(Const.ID.MAGISK_UPDATE_NOTIFICATION_ID,
PendingIntent.FLAG_UPDATE_CURRENT);
@ -47,7 +46,7 @@ public class NotificationMgr {
String filename = Utils.fmt("MagiskManager-v%s(%d).apk",
Data.remoteManagerVersionString, Data.remoteManagerVersionCode);
Intent intent = new Intent(mm, ManagerUpdate.class);
Intent intent = new Intent(mm, j.class);
intent.putExtra(Const.Key.INTENT_SET_LINK, Data.managerLink);
intent.putExtra(Const.Key.INTENT_SET_FILENAME, filename);
PendingIntent pendingIntent = PendingIntent.getBroadcast(mm,
@ -69,7 +68,7 @@ public class NotificationMgr {
public static void dtboPatched() {
MagiskManager mm = Data.MM();
Intent intent = new Intent(mm, RebootReceiver.class);
Intent intent = new Intent(mm, k.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(mm,
Const.ID.DTBO_NOTIFICATION_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT);

View File

@ -18,12 +18,13 @@ import com.topjohnwu.magisk.MagiskManager;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.container.Module;
import com.topjohnwu.magisk.container.ValueSortedMap;
import com.topjohnwu.magisk.services.UpdateCheckService;
import com.topjohnwu.superuser.io.SuFile;
import java.util.Locale;
import java.util.Map;
import a.n;
public class Utils {
public static int getPrefsInt(SharedPreferences prefs, String key, int def) {
@ -77,7 +78,7 @@ public class Utils {
if (mm.prefs.getBoolean(Const.Key.CHECK_UPDATES, true)) {
if (scheduler.getAllPendingJobs().isEmpty() ||
Const.UPDATE_SERVICE_VER > mm.prefs.getInt(Const.Key.UPDATE_SERVICE_VER, -1)) {
ComponentName service = new ComponentName(mm, UpdateCheckService.class);
ComponentName service = new ComponentName(mm, n.class);
JobInfo info = new JobInfo.Builder(Const.ID.UPDATE_SERVICE_ID, service)
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
.setPersisted(true)

View File

@ -54,42 +54,42 @@
android:textAppearance="@style/TextAppearance.AppCompat.Headline"/>
</LinearLayout>
<com.topjohnwu.magisk.components.AboutCardRow
<a.o
android:id="@+id/app_version_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_info_outline"
app:text="@string/app_version"/>
<com.topjohnwu.magisk.components.AboutCardRow
<a.o
android:id="@+id/app_changelog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_history"
app:text="@string/app_changelog"/>
<com.topjohnwu.magisk.components.AboutCardRow
<a.o
android:id="@+id/app_translators"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_language"
app:text="@string/app_translators"/>
<com.topjohnwu.magisk.components.AboutCardRow
<a.o
android:id="@+id/follow_twitter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_twitter"
app:text="@string/follow_twitter"/>
<com.topjohnwu.magisk.components.AboutCardRow
<a.o
android:id="@+id/app_source_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_github"
app:text="@string/app_source_code"/>
<com.topjohnwu.magisk.components.AboutCardRow
<a.o
android:id="@+id/support_thread"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -40,14 +40,14 @@
android:text="@string/donation"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"/>
<com.topjohnwu.magisk.components.AboutCardRow
<a.o
android:id="@+id/paypal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_paypal"
app:text="PayPal"/>
<com.topjohnwu.magisk.components.AboutCardRow
<a.o
android:id="@+id/patreon"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -15,7 +15,7 @@
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
tools:ignore="UnusedAttribute">
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
<provider
android:name="androidx.core.content.FileProvider"

View File

@ -0,0 +1,7 @@
package a;
import com.topjohnwu.magisk.NoUIActivity;
public class g extends NoUIActivity {
/* stub */
}

View File

@ -6,7 +6,6 @@ import android.content.pm.PackageManager;
import android.os.Bundle;
import android.widget.Toast;
import com.topjohnwu.magisk.NoUIActivity;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.utils.Download;
@ -35,7 +34,7 @@ public abstract class BaseActivity extends FlavorActivity {
permissionGrantCallback = callback;
if (!(context instanceof BaseActivity)) {
// Start activity to show dialog
Intent intent = new Intent(context, NoUIActivity.class);
Intent intent = new Intent(context, a.g.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(INTENT_PERM, permissions);
context.startActivity(intent);