Magisk/app/src/full/java/com/topjohnwu/magisk/MagiskManager.java

53 lines
1.4 KiB
Java
Raw Normal View History

2017-02-07 02:01:32 +08:00
package com.topjohnwu.magisk;
import android.content.SharedPreferences;
2018-08-01 14:16:44 +08:00
import android.content.res.Configuration;
2017-02-07 02:01:32 +08:00
import android.preference.PreferenceManager;
import com.topjohnwu.magisk.database.MagiskDB;
2018-04-07 00:45:10 +08:00
import com.topjohnwu.magisk.database.RepoDatabaseHelper;
2018-07-31 17:35:58 +08:00
import com.topjohnwu.magisk.utils.LocaleManager;
2018-06-02 22:00:52 +08:00
import com.topjohnwu.magisk.utils.RootUtils;
2018-07-30 20:37:00 +08:00
import com.topjohnwu.superuser.ContainerApp;
2018-01-21 06:07:24 +08:00
import com.topjohnwu.superuser.Shell;
2018-06-02 22:00:52 +08:00
2017-10-16 00:54:48 +08:00
import java.lang.ref.WeakReference;
2017-02-07 02:01:32 +08:00
2018-07-30 20:37:00 +08:00
public class MagiskManager extends ContainerApp {
2017-02-07 02:01:32 +08:00
// Info
2017-11-06 04:47:24 +08:00
public boolean hasInit = false;
2017-02-07 02:01:32 +08:00
2017-06-01 00:19:52 +08:00
// Global resources
2017-02-07 02:01:32 +08:00
public SharedPreferences prefs;
2017-07-21 00:46:13 +08:00
public RepoDatabaseHelper repoDB;
public MagiskDB mDB;
2017-02-07 02:01:32 +08:00
2017-10-16 11:51:34 +08:00
public MagiskManager() {
2018-07-31 17:41:54 +08:00
Data.weakApp = new WeakReference<>(this);
2018-02-12 23:07:35 +08:00
}
@Override
public void onCreate() {
super.onCreate();
2018-07-27 04:48:32 +08:00
Shell.Config.setFlags(Shell.FLAG_MOUNT_MASTER);
Shell.Config.verboseLogging(BuildConfig.DEBUG);
Shell.Config.setInitializer(RootUtils.class);
2018-11-25 03:33:41 -05:00
Shell.Config.setTimeout(2);
2017-10-16 11:51:34 +08:00
2017-08-12 01:31:34 +08:00
prefs = PreferenceManager.getDefaultSharedPreferences(this);
2018-10-28 00:54:56 -04:00
repoDB = new RepoDatabaseHelper(this);
mDB = new MagiskDB(this);
2018-02-13 03:27:27 +08:00
2018-08-01 14:16:44 +08:00
LocaleManager.setLocale(this);
2018-07-31 17:41:54 +08:00
Data.loadConfig();
2017-08-12 01:31:34 +08:00
}
2018-08-01 14:16:44 +08:00
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
LocaleManager.setLocale(this);
}
2017-02-07 02:01:32 +08:00
}