Skip to content

Commit

Permalink
build: disable proguard #19
Browse files Browse the repository at this point in the history
  • Loading branch information
Netdex committed May 4, 2024
1 parent db14593 commit 9ea34ab
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 32 deletions.
18 changes: 9 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
apply plugin: 'com.android.application'

android {
compileSdk 33
compileSdk 34
defaultConfig {
applicationId "org.netdex.androidusbscript"
minSdkVersion 26
targetSdkVersion 33
versionCode 120
versionName '1.2.0'
targetSdkVersion 34
versionCode 121
versionName '1.2.1'
}
buildTypes {
release {
minifyEnabled true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_17
sourceCompatibility JavaVersion.VERSION_17
}
namespace 'org.netdex.androidusbscript'
dependenciesInfo {
Expand All @@ -29,8 +29,8 @@ android {
}

dependencies {
implementation 'androidx.core:core:1.10.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.core:core:1.13.1'
implementation 'com.google.android.material:material:1.12.0'

implementation 'org.luaj:luaj-jse:3.0.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
Expand Down
3 changes: 1 addition & 2 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@
# public *;
#}

# This is generated automatically by the Android Gradle plugin.
-dontwarn javax.script.ScriptEngineFactory
# This is generated automatically by the Android Gradle plugin.
4 changes: 3 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<application
Expand All @@ -27,7 +28,8 @@

<service
android:name="org.netdex.androidusbscript.service.LuaUsbService"
android:enabled="true" />
android:enabled="true"
android:foregroundServiceType="specialUse"/>
</application>

</manifest>
32 changes: 17 additions & 15 deletions app/src/main/assets/scripts/mouse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@

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

-- poll until usb plugged in
while luausb.state() == "not attached" do
wait(1000)
end
while true do
-- poll until usb plugged in
while luausb.state() == "not attached" do
wait(1000)
end

t = 0
s = 0.05
r = 200
x = r
y = 0
while luausb.state() == "configured" do
ax, ay = r * math.cos(t), r * math.sin(t)
dx, dy = math.floor(ax - x), math.floor(ay - y)
x, y = x + dx, y + dy
t = t + s
ms1:move(dx, dy)
t = 0
s = 0.05
r = 200
x = r
y = 0
while luausb.state() == "configured" do
ax, ay = r * math.cos(t), r * math.sin(t)
dx, dy = math.floor(ax - x), math.floor(ay - y)
x, y = x + dx, y + dy
t = t + s
ms1:move(dx, dy)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
Expand All @@ -23,6 +25,7 @@
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.os.HandlerCompat;

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

notificationBroadcastReceiver_ = new NotificationBroadcastReceiver();
IntentFilter filter = new IntentFilter(NotificationBroadcastReceiver.ACTION_STOP);
registerReceiver(notificationBroadcastReceiver_, filter);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
registerReceiver(notificationBroadcastReceiver_, filter, Context.RECEIVER_EXPORTED);
} else {
registerReceiver(notificationBroadcastReceiver_, filter);
}

LuaIOBridge dialogIO = new LuaIOBridge() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ public LuaValue call() {
} catch (IOException e) {
throw new LuaError(e);
}
// return valueOf("unknown");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void run(FileSystem fs) {
if (e.getCause() instanceof IOException) {
throw (IOException) e.getCause();
} else if (!(e.getCause() instanceof InterruptedException)) {
e.printStackTrace();
ioBridge_.onLogMessage(getExceptionMessage(e));
}
} finally {
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.2'
classpath 'com.android.tools.build:gradle:8.2.2'

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

task clean(type: Delete) {
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Fri Nov 13 11:15:42 EST 2020
android.defaults.buildfeatures.buildconfig=true
android.enableJetifier=false
android.nonFinalResIds=false
android.nonTransitiveRClass=true
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip

0 comments on commit 9ea34ab

Please sign in to comment.