Skip to content
This repository was archived by the owner on Sep 12, 2025. It is now read-only.

Commit ae559dd

Browse files
committed
forked as Boot Control
added activate button updated gradle wrapper
1 parent 6f0aa70 commit ae559dd

27 files changed

Lines changed: 278 additions & 148 deletions

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Devinfo Patcher
1+
# Boot Control
22

3-
Devinfo Patcher is an Android app that marks the inactive slot as successful on devices with a valid `devinfo` partition.
3+
Boot Control is an Android app that toggles the active slot. It first attempts to modify the `devinfo` partition, if a valid one is found, then falls back on modifying the partition table entries of the `boot` partitions.
44

55
## Usage
66

7-
If the inactive slot is not marked as successful, pressing the `Patch` button will mark it.
7+
Pressing the `Activate` button on the inactive slot will toggle the active slot.

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ android {
77
compileSdk 31
88

99
defaultConfig {
10-
applicationId "com.github.capntrips.devinfopatcher"
10+
applicationId "com.github.capntrips.bootcontrol"
1111
minSdk 31
1212
targetSdk 31
1313
versionCode 2
14-
versionName "1.0.0-alpha02"
14+
versionName "1.0.0-alpha01"
1515

1616
vectorDrawables {
1717
useSupportLibrary true

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.github.capntrips.devinfopatcher">
3+
package="com.github.capntrips.bootcontrol">
44

55
<application
66
android:allowBackup="false"
@@ -10,7 +10,7 @@
1010
android:supportsRtl="true"
1111
android:theme="@style/Theme.Material3.DayNight.NoActionBar">
1212
<activity
13-
android:name="com.github.capntrips.devinfopatcher.MainActivity"
13+
android:name="com.github.capntrips.bootcontrol.MainActivity"
1414
android:exported="true"
1515
android:theme="@style/Theme.MainSplashScreen">
1616
<intent-filter>

app/src/main/java/com/github/capntrips/devinfopatcher/DeviceState.kt renamed to app/src/main/java/com/github/capntrips/bootcontrol/DeviceState.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.capntrips.devinfopatcher
1+
package com.github.capntrips.bootcontrol
22

33
import android.content.Context
44
import com.topjohnwu.superuser.Shell

app/src/main/java/com/github/capntrips/devinfopatcher/DeviceStateInterface.kt renamed to app/src/main/java/com/github/capntrips/bootcontrol/DeviceStateInterface.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.capntrips.devinfopatcher
1+
package com.github.capntrips.bootcontrol
22

33
import android.content.Context
44
import kotlinx.coroutines.flow.StateFlow

app/src/main/java/com/github/capntrips/devinfopatcher/DeviceStatePreview.kt renamed to app/src/main/java/com/github/capntrips/bootcontrol/DeviceStatePreview.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.capntrips.devinfopatcher
1+
package com.github.capntrips.bootcontrol
22

33
import android.content.Context
44
import androidx.lifecycle.ViewModel

app/src/main/java/com/github/capntrips/devinfopatcher/DevinfoImageFlags.kt renamed to app/src/main/java/com/github/capntrips/bootcontrol/DevinfoImageFlags.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.capntrips.devinfopatcher
1+
package com.github.capntrips.bootcontrol
22

33
enum class DevinfoImageFlags(val position: Byte) {
44
Unbootable(1),

app/src/main/java/com/github/capntrips/devinfopatcher/ErrorScreen.kt renamed to app/src/main/java/com/github/capntrips/bootcontrol/ErrorScreen.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.capntrips.devinfopatcher
1+
package com.github.capntrips.bootcontrol
22

33
import android.content.res.Configuration
44
import androidx.compose.foundation.layout.Box
@@ -20,8 +20,8 @@ import androidx.compose.ui.Modifier
2020
import androidx.compose.ui.res.stringResource
2121
import androidx.compose.ui.tooling.preview.Preview
2222
import androidx.compose.ui.unit.dp
23-
import com.github.capntrips.devinfopatcher.ui.theme.DevinfoPatcherTheme
24-
import com.github.capntrips.devinfopatcher.ui.theme.Orange500
23+
import com.github.capntrips.bootcontrol.ui.theme.BootControlTheme
24+
import com.github.capntrips.bootcontrol.ui.theme.Orange500
2525

2626
@ExperimentalMaterial3Api
2727
@Composable
@@ -64,7 +64,7 @@ fun ErrorScreenPreviewDark() {
6464
@Preview(showBackground = true)
6565
@Composable
6666
fun ErrorScreenPreviewLight() {
67-
DevinfoPatcherTheme {
67+
BootControlTheme {
6868
ErrorScreen(stringResource(R.string.root_required))
6969
}
7070
}

app/src/main/java/com/github/capntrips/devinfopatcher/MainActivity.kt renamed to app/src/main/java/com/github/capntrips/bootcontrol/MainActivity.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.capntrips.devinfopatcher
1+
package com.github.capntrips.bootcontrol
22

33
import android.animation.ObjectAnimator
44
import android.animation.PropertyValuesHolder
@@ -17,7 +17,7 @@ import androidx.compose.ui.graphics.luminance
1717
import androidx.compose.ui.res.stringResource
1818
import androidx.core.animation.doOnEnd
1919
import androidx.core.view.WindowCompat
20-
import com.github.capntrips.devinfopatcher.ui.theme.DevinfoPatcherTheme
20+
import com.github.capntrips.bootcontrol.ui.theme.BootControlTheme
2121
import com.google.accompanist.insets.ProvideWindowInsets
2222
import com.google.accompanist.systemuicontroller.rememberSystemUiController
2323
import com.topjohnwu.superuser.Shell
@@ -52,7 +52,7 @@ class MainActivity : ComponentActivity() {
5252
}
5353

5454
setContent {
55-
DevinfoPatcherTheme {
55+
BootControlTheme {
5656
val systemUiController = rememberSystemUiController()
5757
val darkIcons = MaterialTheme.colorScheme.background.luminance() > 0.5f
5858
SideEffect {

app/src/main/java/com/github/capntrips/devinfopatcher/MainContent.kt renamed to app/src/main/java/com/github/capntrips/bootcontrol/MainContent.kt

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.capntrips.devinfopatcher
1+
package com.github.capntrips.bootcontrol
22

33
import android.content.res.Configuration
44
import android.os.Build
@@ -34,7 +34,7 @@ import androidx.compose.ui.tooling.preview.Preview
3434
import androidx.compose.ui.unit.Dp
3535
import androidx.compose.ui.unit.dp
3636
import androidx.lifecycle.viewmodel.compose.viewModel
37-
import com.github.capntrips.devinfopatcher.ui.theme.DevinfoPatcherTheme
37+
import com.github.capntrips.bootcontrol.ui.theme.BootControlTheme
3838
import kotlinx.coroutines.flow.StateFlow
3939

4040
@Composable
@@ -58,12 +58,14 @@ fun MainContent(viewModel: MainViewModelInterface) {
5858
Spacer(Modifier.height(16.dp))
5959
SlotCard(
6060
title = stringResource(R.string.slot_a),
61+
viewModel=viewModel,
6162
slotStateFlow = uiState.slotA,
6263
isActive = uiState.slotSuffix == "_a"
6364
)
6465
Spacer(Modifier.height(16.dp))
6566
SlotCard(
6667
title = stringResource(R.string.slot_b),
68+
viewModel=viewModel,
6769
slotStateFlow = uiState.slotB,
6870
isActive = uiState.slotSuffix == "_b"
6971
)
@@ -73,6 +75,7 @@ fun MainContent(viewModel: MainViewModelInterface) {
7375
@Composable
7476
fun SlotCard(
7577
title: String,
78+
viewModel: MainViewModelInterface,
7679
slotStateFlow: StateFlow<SlotStateInterface>,
7780
isActive: Boolean
7881
) {
@@ -83,9 +86,11 @@ fun SlotCard(
8386
title = title,
8487
button = {
8588
if (!isRefreshing) {
86-
if (!isActive) {
89+
if (!slot.active) {
8790
if (!slot.successful) {
8891
PatchButton(slot)
92+
} else {
93+
ActivateButton(viewModel, slot)
8994
}
9095
}
9196
}
@@ -130,6 +135,18 @@ fun PatchButton(slot: SlotStateInterface) {
130135
}
131136
}
132137

138+
@Composable
139+
fun ActivateButton(viewModel: MainViewModelInterface, slot: SlotStateInterface) {
140+
val context = LocalContext.current
141+
Button(
142+
modifier = Modifier.padding(0.dp),
143+
shape = RoundedCornerShape(4.0.dp),
144+
onClick = { viewModel.activate(context, slot) }
145+
) {
146+
Text(stringResource(R.string.activate))
147+
}
148+
}
149+
133150
@Composable
134151
fun DataCard(
135152
title: String,
@@ -239,7 +256,7 @@ fun MainContentPreviewDark() {
239256
@Preview(showBackground = true)
240257
@Composable
241258
fun MainContentPreviewLight() {
242-
DevinfoPatcherTheme {
259+
BootControlTheme {
243260
Scaffold {
244261
val viewModel: MainViewModelPreview = viewModel()
245262
MainContent(viewModel)

0 commit comments

Comments
 (0)