Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2025-01-30 - State Feedback for Native Operations
**Learning:** For buttons triggering one-time native operations like library loading, providing immediate visual state changes (disabling and updating text) prevents redundant user actions and clarifies the current application state.
**Action:** Always disable "Load" or "Hook" buttons and update their labels to "Loaded" or "Hooked" upon successful execution to provide clear, persistent feedback.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import com.bytedance.shadowhook.ShadowHook;
import com.bytedance.shadowhook.systest.SysTest;
Expand Down Expand Up @@ -64,6 +65,10 @@ public void onUnitTestLoadClick(View view) {
if(!hookee2Loaded) {
hookee2Loaded = true;
System.loadLibrary("hookee2");

Button btn = (Button) view;
btn.setEnabled(false);
btn.setText(R.string.load_libhookee2_done);
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<Button style="@style/Theme.Button.Red"
android:id="@+id/unitTestLoad"
android:onClick="onUnitTestLoadClick"
android:text="load libhookee2.so (automatically hook)" />
android:text="@string/load_libhookee2" />

<Button style="@style/Theme.Button.Red"
android:id="@+id/unitTestRun"
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<resources>
<string name="app_name">shadowhook</string>
</resources>
<string name="load_libhookee2">load libhookee2.so (automatically hook)</string>
<string name="load_libhookee2_done">libhookee2.so loaded</string>
</resources>
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
plugins {
id 'com.android.application' version '7.4.2' apply false
id 'com.android.library' version '7.4.2' apply false
id 'com.android.application' version '8.2.2' apply false
id 'com.android.library' version '8.2.2' apply false
}

task clean(type: Delete) {
delete rootProject.buildDir
delete rootProject.layout.buildDirectory
}

ext {
minSdkVersion = 16
compileSdkVersion = 34
targetSdkVersion = 34
buildToolsVersion = '34.0.0'
javaVersion = JavaVersion.VERSION_1_7
javaVersion = JavaVersion.VERSION_1_8
ndkVersion = "23.2.8568313"
cmakeVersion = "3.22.1"
abiFilters = "armeabi-v7a,arm64-v8a"
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ android.useAndroidX=true
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
#android.prefabVersion=2.0.0
android.disableAutomaticComponentCreation=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Dec 30 21:41:31 CST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME