Reformat root access–related classes
This commit is contained in:
@@ -5,7 +5,6 @@ import android.os.IBinder
|
||||
import com.topjohnwu.superuser.ipc.RootService
|
||||
|
||||
class RootHelper : RootService() {
|
||||
|
||||
override fun onBind(intent: Intent): IBinder {
|
||||
return RootHelperBackend(this)
|
||||
}
|
||||
|
||||
@@ -2,13 +2,11 @@ package app.lawnchair.root;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.PowerManager;
|
||||
import android.os.RemoteException;
|
||||
import android.os.SystemClock;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
public class RootHelperBackend extends IRootHelper.Stub {
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
public RootHelperBackend(Context context) {
|
||||
|
||||
@@ -14,7 +14,6 @@ import kotlin.coroutines.resume
|
||||
import kotlin.coroutines.suspendCoroutine
|
||||
|
||||
class RootHelperManager(private val context: Context) {
|
||||
|
||||
private val prefs = PreferenceManager.getInstance(context)
|
||||
private var rootHelper: IRootHelper? = null
|
||||
private val connectionListeners = CopyOnWriteArraySet<Runnable>()
|
||||
@@ -33,11 +32,9 @@ class RootHelperManager(private val context: Context) {
|
||||
@Throws(RootNotAvailableException::class)
|
||||
suspend fun getService(): IRootHelper {
|
||||
prefs.autoLaunchRoot.set(isAvailable)
|
||||
if (!isAvailable) throw RootNotAvailableException()
|
||||
|
||||
if (rootHelper != null) {
|
||||
return rootHelper!!
|
||||
}
|
||||
if (!isAvailable) throw RootNotAvailableException()
|
||||
if (rootHelper != null) return rootHelper!!
|
||||
|
||||
val intent = Intent(context, RootHelper::class.java)
|
||||
RootService.bind(intent, connection)
|
||||
|
||||
Reference in New Issue
Block a user