Skip to content

Commit 9ea34ab

Browse files
committed
build: disable proguard #19
1 parent db14593 commit 9ea34ab

File tree

10 files changed

+43
-32
lines changed

10 files changed

+43
-32
lines changed

app/build.gradle

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdk 33
4+
compileSdk 34
55
defaultConfig {
66
applicationId "org.netdex.androidusbscript"
77
minSdkVersion 26
8-
targetSdkVersion 33
9-
versionCode 120
10-
versionName '1.2.0'
8+
targetSdkVersion 34
9+
versionCode 121
10+
versionName '1.2.1'
1111
}
1212
buildTypes {
1313
release {
14-
minifyEnabled true
14+
minifyEnabled false
1515
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1616
}
1717
}
1818
productFlavors {
1919
}
2020
compileOptions {
21-
targetCompatibility JavaVersion.VERSION_1_8
22-
sourceCompatibility JavaVersion.VERSION_1_8
21+
targetCompatibility JavaVersion.VERSION_17
22+
sourceCompatibility JavaVersion.VERSION_17
2323
}
2424
namespace 'org.netdex.androidusbscript'
2525
dependenciesInfo {
@@ -29,8 +29,8 @@ android {
2929
}
3030

3131
dependencies {
32-
implementation 'androidx.core:core:1.10.1'
33-
implementation 'com.google.android.material:material:1.9.0'
32+
implementation 'androidx.core:core:1.13.1'
33+
implementation 'com.google.android.material:material:1.12.0'
3434

3535
implementation 'org.luaj:luaj-jse:3.0.1'
3636
implementation 'androidx.appcompat:appcompat:1.6.1'

app/proguard-rules.pro

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@
1616
# public *;
1717
#}
1818

19-
# This is generated automatically by the Android Gradle plugin.
20-
-dontwarn javax.script.ScriptEngineFactory
19+
# This is generated automatically by the Android Gradle plugin.

app/src/main/AndroidManifest.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
33

44
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
5+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
56
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
67

78
<application
@@ -27,7 +28,8 @@
2728

2829
<service
2930
android:name="org.netdex.androidusbscript.service.LuaUsbService"
30-
android:enabled="true" />
31+
android:enabled="true"
32+
android:foregroundServiceType="specialUse"/>
3133
</application>
3234

3335
</manifest>

app/src/main/assets/scripts/mouse.lua

+17-15
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44

55
ms1 = luausb.create({ type = "mouse", id = 0 })
66

7-
-- poll until usb plugged in
8-
while luausb.state() == "not attached" do
9-
wait(1000)
10-
end
7+
while true do
8+
-- poll until usb plugged in
9+
while luausb.state() == "not attached" do
10+
wait(1000)
11+
end
1112

12-
t = 0
13-
s = 0.05
14-
r = 200
15-
x = r
16-
y = 0
17-
while luausb.state() == "configured" do
18-
ax, ay = r * math.cos(t), r * math.sin(t)
19-
dx, dy = math.floor(ax - x), math.floor(ay - y)
20-
x, y = x + dx, y + dy
21-
t = t + s
22-
ms1:move(dx, dy)
13+
t = 0
14+
s = 0.05
15+
r = 200
16+
x = r
17+
y = 0
18+
while luausb.state() == "configured" do
19+
ax, ay = r * math.cos(t), r * math.sin(t)
20+
dx, dy = math.floor(ax - x), math.floor(ay - y)
21+
x, y = x + dx, y + dy
22+
t = t + s
23+
ms1:move(dx, dy)
24+
end
2325
end

app/src/main/java/org/netdex/androidusbscript/MainActivity.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
import android.app.Activity;
44
import android.content.ComponentName;
5+
import android.content.Context;
56
import android.content.Intent;
67
import android.content.IntentFilter;
78
import android.net.Uri;
9+
import android.os.Build;
810
import android.os.Bundle;
911
import android.os.Handler;
1012
import android.os.IBinder;
@@ -23,6 +25,7 @@
2325
import androidx.activity.result.ActivityResultLauncher;
2426
import androidx.activity.result.contract.ActivityResultContracts;
2527
import androidx.annotation.NonNull;
28+
import androidx.annotation.RequiresApi;
2629
import androidx.appcompat.app.AppCompatActivity;
2730
import androidx.core.os.HandlerCompat;
2831

@@ -69,7 +72,11 @@ protected void onCreate(Bundle savedInstanceState) {
6972

7073
notificationBroadcastReceiver_ = new NotificationBroadcastReceiver();
7174
IntentFilter filter = new IntentFilter(NotificationBroadcastReceiver.ACTION_STOP);
72-
registerReceiver(notificationBroadcastReceiver_, filter);
75+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
76+
registerReceiver(notificationBroadcastReceiver_, filter, Context.RECEIVER_EXPORTED);
77+
} else {
78+
registerReceiver(notificationBroadcastReceiver_, filter);
79+
}
7380

7481
LuaIOBridge dialogIO = new LuaIOBridge() {
7582
@Override

app/src/main/java/org/netdex/androidusbscript/task/LuaUsbLibrary.java

+1
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ public LuaValue call() {
216216
} catch (IOException e) {
217217
throw new LuaError(e);
218218
}
219+
// return valueOf("unknown");
219220
}
220221
}
221222
}

app/src/main/java/org/netdex/androidusbscript/task/LuaUsbTask.java

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public void run(FileSystem fs) {
5757
if (e.getCause() instanceof IOException) {
5858
throw (IOException) e.getCause();
5959
} else if (!(e.getCause() instanceof InterruptedException)) {
60+
e.printStackTrace();
6061
ioBridge_.onLogMessage(getExceptionMessage(e));
6162
}
6263
} finally {

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ buildscript {
1010
google()
1111
}
1212
dependencies {
13-
classpath 'com.android.tools.build:gradle:8.0.2'
13+
classpath 'com.android.tools.build:gradle:8.2.2'
1414

1515
// NOTE: Do not place your application dependencies here; they belong
1616
// in the individual module build.gradle files
@@ -27,6 +27,6 @@ allprojects {
2727
}
2828
}
2929

30-
task clean(type: Delete) {
30+
tasks.register('clean', Delete) {
3131
delete rootProject.buildDir
3232
}

gradle.properties

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1212
# org.gradle.parallel=true
1313
#Fri Nov 13 11:15:42 EST 2020
14-
android.defaults.buildfeatures.buildconfig=true
1514
android.enableJetifier=false
1615
android.nonFinalResIds=false
1716
android.nonTransitiveRClass=true

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip

0 commit comments

Comments
 (0)