-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated dependencies
- Loading branch information
Showing
43 changed files
with
4,745 additions
and
646 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
android_app { | ||
name: "BootControl", | ||
srcs: [ | ||
"app/src/main/java/**/*.kt", | ||
// TODO: fix setActiveBootSlot | ||
"app/src/main/java/**/*.java", | ||
"app/src/main/aidl/**/*.aidl", | ||
], | ||
resource_dirs: ["app/src/main/res"], | ||
manifest: "app/src/main/AndroidManifest.xml", | ||
static_libs: [ | ||
"androidx.activity_activity-compose", | ||
"androidx.activity_activity-ktx", | ||
"androidx.appcompat_appcompat", | ||
"androidx.compose.foundation_foundation-layout", | ||
"androidx.compose.material3_material3", | ||
"androidx.compose.material_material-icons-extended", | ||
"androidx.compose.material_material", | ||
"androidx.compose.runtime_runtime", | ||
"androidx.compose.ui_ui", | ||
"androidx.core_core-ktx", | ||
"androidx.core_core-splashscreen", | ||
"androidx.lifecycle_lifecycle-runtime-ktx", | ||
"androidx.lifecycle_lifecycle-viewmodel-compose", | ||
"androidx.navigation_navigation-compose", | ||
"com.google.android.material_material", | ||
"hwbinder.stubs", | ||
"com.github.topjohnwu.libsu_service", | ||
"com.github.topjohnwu.libsu_core", | ||
], | ||
// TODO: build for api 29 | ||
platform_apis: true, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Boot Control | ||
|
||
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. | ||
Boot Control is an Android app that toggles the active boot slot. | ||
|
||
## Usage | ||
|
||
Pressing the `Activate` button on the inactive slot will toggle the active slot. | ||
Pressing the `Activate` button will toggle the active boot slot. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/build | ||
/release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
app/src/main/aidl/com/github/capntrips/bootcontrol/IBootControlService.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.github.capntrips.bootcontrol; | ||
|
||
interface IBootControlService { | ||
String halInfo(); | ||
float halVersion(); | ||
int getNumberSlots(); | ||
int getCurrentSlot(); | ||
boolean setActiveBootSlot(int slot); | ||
boolean isSlotBootable(int slot); | ||
boolean isSlotMarkedSuccessful(int slot); | ||
String getSuffix(int slot); | ||
int getActiveBootSlot(); | ||
} |
40 changes: 40 additions & 0 deletions
40
app/src/main/java/android/hardware/boot/V1_0/BoolResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package android.hardware.boot.V1_0; | ||
|
||
|
||
public final class BoolResult { | ||
public static final int FALSE = 0; | ||
public static final int TRUE = 1; | ||
public static final int INVALID_SLOT = -1 /* -1 */; | ||
public static final String toString(int o) { | ||
if (o == FALSE) { | ||
return "FALSE"; | ||
} | ||
if (o == TRUE) { | ||
return "TRUE"; | ||
} | ||
if (o == INVALID_SLOT) { | ||
return "INVALID_SLOT"; | ||
} | ||
return "0x" + Integer.toHexString(o); | ||
} | ||
|
||
public static final String dumpBitfield(int o) { | ||
java.util.ArrayList<String> list = new java.util.ArrayList<>(); | ||
int flipped = 0; | ||
list.add("FALSE"); // FALSE == 0 | ||
if ((o & TRUE) == TRUE) { | ||
list.add("TRUE"); | ||
flipped |= TRUE; | ||
} | ||
if ((o & INVALID_SLOT) == INVALID_SLOT) { | ||
list.add("INVALID_SLOT"); | ||
flipped |= INVALID_SLOT; | ||
} | ||
if (o != flipped) { | ||
list.add("0x" + Integer.toHexString(o & (~flipped))); | ||
} | ||
return String.join(" | ", list); | ||
} | ||
|
||
}; | ||
|
115 changes: 115 additions & 0 deletions
115
app/src/main/java/android/hardware/boot/V1_0/CommandResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
package android.hardware.boot.V1_0; | ||
|
||
|
||
public final class CommandResult { | ||
public boolean success = false; | ||
public String errMsg = new String(); | ||
|
||
@Override | ||
public final boolean equals(Object otherObject) { | ||
if (this == otherObject) { | ||
return true; | ||
} | ||
if (otherObject == null) { | ||
return false; | ||
} | ||
if (otherObject.getClass() != android.hardware.boot.V1_0.CommandResult.class) { | ||
return false; | ||
} | ||
android.hardware.boot.V1_0.CommandResult other = (android.hardware.boot.V1_0.CommandResult)otherObject; | ||
if (this.success != other.success) { | ||
return false; | ||
} | ||
if (!android.os.HidlSupport.deepEquals(this.errMsg, other.errMsg)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
@Override | ||
public final int hashCode() { | ||
return java.util.Objects.hash( | ||
android.os.HidlSupport.deepHashCode(this.success), | ||
android.os.HidlSupport.deepHashCode(this.errMsg)); | ||
} | ||
|
||
@Override | ||
public final String toString() { | ||
java.lang.StringBuilder builder = new java.lang.StringBuilder(); | ||
builder.append("{"); | ||
builder.append(".success = "); | ||
builder.append(this.success); | ||
builder.append(", .errMsg = "); | ||
builder.append(this.errMsg); | ||
builder.append("}"); | ||
return builder.toString(); | ||
} | ||
|
||
public final void readFromParcel(android.os.HwParcel parcel) { | ||
android.os.HwBlob blob = parcel.readBuffer(24 /* size */); | ||
readEmbeddedFromParcel(parcel, blob, 0 /* parentOffset */); | ||
} | ||
|
||
public static final java.util.ArrayList<CommandResult> readVectorFromParcel(android.os.HwParcel parcel) { | ||
java.util.ArrayList<CommandResult> _hidl_vec = new java.util.ArrayList(); | ||
android.os.HwBlob _hidl_blob = parcel.readBuffer(16 /* sizeof hidl_vec<T> */); | ||
|
||
{ | ||
int _hidl_vec_size = _hidl_blob.getInt32(0 + 8 /* offsetof(hidl_vec<T>, mSize) */); | ||
android.os.HwBlob childBlob = parcel.readEmbeddedBuffer( | ||
_hidl_vec_size * 24,_hidl_blob.handle(), | ||
0 + 0 /* offsetof(hidl_vec<T>, mBuffer) */,true /* nullable */); | ||
|
||
_hidl_vec.clear(); | ||
for (int _hidl_index_0 = 0; _hidl_index_0 < _hidl_vec_size; ++_hidl_index_0) { | ||
android.hardware.boot.V1_0.CommandResult _hidl_vec_element = new android.hardware.boot.V1_0.CommandResult(); | ||
((android.hardware.boot.V1_0.CommandResult) _hidl_vec_element).readEmbeddedFromParcel(parcel, childBlob, _hidl_index_0 * 24); | ||
_hidl_vec.add(_hidl_vec_element); | ||
} | ||
} | ||
|
||
return _hidl_vec; | ||
} | ||
|
||
public final void readEmbeddedFromParcel( | ||
android.os.HwParcel parcel, android.os.HwBlob _hidl_blob, long _hidl_offset) { | ||
success = _hidl_blob.getBool(_hidl_offset + 0); | ||
errMsg = _hidl_blob.getString(_hidl_offset + 8); | ||
|
||
parcel.readEmbeddedBuffer( | ||
((String) errMsg).getBytes().length + 1, | ||
_hidl_blob.handle(), | ||
_hidl_offset + 8 + 0 /* offsetof(hidl_string, mBuffer) */,false /* nullable */); | ||
|
||
} | ||
|
||
public final void writeToParcel(android.os.HwParcel parcel) { | ||
android.os.HwBlob _hidl_blob = new android.os.HwBlob(24 /* size */); | ||
writeEmbeddedToBlob(_hidl_blob, 0 /* parentOffset */); | ||
parcel.writeBuffer(_hidl_blob); | ||
} | ||
|
||
public static final void writeVectorToParcel( | ||
android.os.HwParcel parcel, java.util.ArrayList<CommandResult> _hidl_vec) { | ||
android.os.HwBlob _hidl_blob = new android.os.HwBlob(16 /* sizeof(hidl_vec<T>) */); | ||
{ | ||
int _hidl_vec_size = _hidl_vec.size(); | ||
_hidl_blob.putInt32(0 + 8 /* offsetof(hidl_vec<T>, mSize) */, _hidl_vec_size); | ||
_hidl_blob.putBool(0 + 12 /* offsetof(hidl_vec<T>, mOwnsBuffer) */, false); | ||
android.os.HwBlob childBlob = new android.os.HwBlob((int)(_hidl_vec_size * 24)); | ||
for (int _hidl_index_0 = 0; _hidl_index_0 < _hidl_vec_size; ++_hidl_index_0) { | ||
_hidl_vec.get(_hidl_index_0).writeEmbeddedToBlob(childBlob, _hidl_index_0 * 24); | ||
} | ||
_hidl_blob.putBlob(0 + 0 /* offsetof(hidl_vec<T>, mBuffer) */, childBlob); | ||
} | ||
|
||
parcel.writeBuffer(_hidl_blob); | ||
} | ||
|
||
public final void writeEmbeddedToBlob( | ||
android.os.HwBlob _hidl_blob, long _hidl_offset) { | ||
_hidl_blob.putBool(_hidl_offset + 0, success); | ||
_hidl_blob.putString(_hidl_offset + 8, errMsg); | ||
} | ||
}; | ||
|
Oops, something went wrong.