diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9f95d99 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +* text=auto eol=lf +*.bat text eol=crlf +*.jar binary diff --git a/.github/workflows/publish-update-json.yaml b/.github/workflows/publish-update-json.yaml index 8bbe811..96b2e0a 100644 --- a/.github/workflows/publish-update-json.yaml +++ b/.github/workflows/publish-update-json.yaml @@ -37,8 +37,10 @@ jobs: mkdir -p "$TEMP_ROOT" echo "Generate changelog.md" - - echo '${{ github.event.release.body }}' > "$PUBLIC_ROOT/changelog.md" + + cat << __EOF_OF_CHANGELOGS__ > "$PUBLIC_ROOT/changelog.md" + ${{ github.event.release.body }} + __EOF_OF_CHANGELOGS__ echo "Fetching release assets" diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 9ac5b22..929550e 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,9 +1,11 @@ -import com.android.build.api.artifact.SingleArtifact - plugins { id("com.android.application") } +android { + namespace = "com.github.kr328.clipboard" +} + dependencies { compileOnly(project(":hideapi")) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7b05b7e..ff47e1a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools"> { val isApp = this is AppExtension - println("Configure $name: isApp = $isApp") - compileSdkVersion(31) defaultConfig { @@ -28,10 +26,10 @@ subprojects { } minSdk = 29 - targetSdk = 31 + targetSdk = 33 - versionName = "v23" - versionCode = 23 + versionName = "v24" + versionCode = 24 if (!isApp) { consumerProguardFiles("consumer-rules.pro") diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 41d9927..943f0cb 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 00e33ed..f398c33 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787..65dcd68 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -205,6 +209,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index ac1b06f..93e3f59 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,89 +1,92 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/hideapi/build.gradle.kts b/hideapi/build.gradle.kts index 762405b..bf5f56d 100644 --- a/hideapi/build.gradle.kts +++ b/hideapi/build.gradle.kts @@ -2,6 +2,10 @@ plugins { id("com.android.library") } +android { + namespace = "com.github.kr328.hideapi" +} + dependencies { annotationProcessor(libs.refine.processor) diff --git a/hideapi/src/main/AndroidManifest.xml b/hideapi/src/main/AndroidManifest.xml index 12009c0..8072ee0 100644 --- a/hideapi/src/main/AndroidManifest.xml +++ b/hideapi/src/main/AndroidManifest.xml @@ -1,2 +1,2 @@ - + diff --git a/module/build.gradle.kts b/module/build.gradle.kts index 387393d..273c9ea 100644 --- a/module/build.gradle.kts +++ b/module/build.gradle.kts @@ -7,6 +7,8 @@ plugins { } android { + namespace = "com.github.kr328.module" + sourceSets { all { assets.srcDir(buildDir.resolve("intermediates/manager_apk/$name")) @@ -15,32 +17,34 @@ android { } zygote { - val moduleId = "clipboard_whitelist" + val moduleId = "clipboard-whitelist" val moduleName = "Clipboard Whitelist" val moduleDescription = "Allow apps access clipboard in background." val moduleAuthor = "Kr328" val moduleEntrypoint = "com.github.kr328.clipboard.Main" + val versionName = android.defaultConfig.versionName packages(PACKAGE_SYSTEM_SERVER) riru { - id = "riru_$moduleId" + id = "riru-$moduleId".replace('-', '_') name = "Riru - $moduleName" - author = moduleAuthor - description = moduleDescription - entrypoint = moduleEntrypoint - archiveName = "${id.replace('_', '-')}-${android.defaultConfig.versionName}" - updateJson = "https://github.com/Kr328/Riru-ClipboardWhitelist/releases/latest/download/${id.replace('_', '-')}.json" + archiveName = "riru-$moduleId-$versionName" + updateJson = "https://github.com/Kr328/Riru-ClipboardWhitelist/releases/latest/download/riru-$moduleId.json" } zygisk { - id = "zygisk_$moduleId" + id = "zygisk-$moduleId".replace('-', '_') name = "Zygisk - $moduleName" + archiveName = "zygisk-$moduleId-$versionName" + updateJson = "https://github.com/Kr328/Riru-ClipboardWhitelist/releases/latest/download/zygisk-$moduleId.json" + } + + all { author = moduleAuthor description = moduleDescription entrypoint = moduleEntrypoint - archiveName = "${id.replace('_', '-')}-${android.defaultConfig.versionName}" - updateJson = "https://github.com/Kr328/Riru-ClipboardWhitelist/releases/latest/download/${id.replace('_', '-')}.json" + isUseBinderInterceptors = true } } @@ -77,4 +81,4 @@ dependencies { implementation(libs.magic.library) } -evaluationDependsOn(":app") \ No newline at end of file +evaluationDependsOn(":app") diff --git a/module/src/main/AndroidManifest.xml b/module/src/main/AndroidManifest.xml index 530b603..8072ee0 100644 --- a/module/src/main/AndroidManifest.xml +++ b/module/src/main/AndroidManifest.xml @@ -1,2 +1,2 @@ - + diff --git a/module/src/main/java/com/github/kr328/clipboard/ClipboardProxy.java b/module/src/main/java/com/github/kr328/clipboard/ClipboardProxy.java index a326eae..889dbb3 100644 --- a/module/src/main/java/com/github/kr328/clipboard/ClipboardProxy.java +++ b/module/src/main/java/com/github/kr328/clipboard/ClipboardProxy.java @@ -35,13 +35,13 @@ public class ClipboardProxy extends IClipboard.Stub { private final WhitelistService whitelistService = new WhitelistService(); - public ClipboardProxy(IClipboard original) { + public ClipboardProxy(final IClipboard original) { this.original = original; } @Override @TransactProxy - public ClipData getPrimaryClip(String callingPackage, int userId) throws RemoteException { + public ClipData getPrimaryClip(final String callingPackage, final int userId) throws RemoteException { final String packageName = markAsDefaultIME(callingPackage, userId); return original.getPrimaryClip(packageName, userId); @@ -49,7 +49,7 @@ public ClipData getPrimaryClip(String callingPackage, int userId) throws RemoteE @Override @TransactProxy - public ClipDescription getPrimaryClipDescription(String callingPackage, int userId) throws RemoteException { + public ClipDescription getPrimaryClipDescription(final String callingPackage, final int userId) throws RemoteException { final String packageName = markAsDefaultIME(callingPackage, userId); return original.getPrimaryClipDescription(packageName, userId); @@ -57,7 +57,7 @@ public ClipDescription getPrimaryClipDescription(String callingPackage, int user @Override @TransactProxy - public boolean hasPrimaryClip(String callingPackage, int userId) throws RemoteException { + public boolean hasPrimaryClip(final String callingPackage, final int userId) throws RemoteException { final String packageName = markAsDefaultIME(callingPackage, userId); return original.hasPrimaryClip(packageName, userId); @@ -65,7 +65,7 @@ public boolean hasPrimaryClip(String callingPackage, int userId) throws RemoteEx @Override @TransactProxy - public boolean hasClipboardText(String callingPackage, int userId) throws RemoteException { + public boolean hasClipboardText(final String callingPackage, final int userId) throws RemoteException { final String packageName = markAsDefaultIME(callingPackage, userId); return original.hasClipboardText(packageName, userId); @@ -73,7 +73,7 @@ public boolean hasClipboardText(String callingPackage, int userId) throws Remote @Override @TransactProxy - public void addPrimaryClipChangedListener(IOnPrimaryClipChangedListener listener, String callingPackage, int userId) throws RemoteException { + public void addPrimaryClipChangedListener(final IOnPrimaryClipChangedListener listener, final String callingPackage, final int userId) throws RemoteException { final String packageName = markAsDefaultIME(callingPackage, userId); original.addPrimaryClipChangedListener(listener, packageName, userId); @@ -81,7 +81,7 @@ public void addPrimaryClipChangedListener(IOnPrimaryClipChangedListener listener @Override @TransactProxy - public void removePrimaryClipChangedListener(IOnPrimaryClipChangedListener listener, String callingPackage, int userId) throws RemoteException { + public void removePrimaryClipChangedListener(final IOnPrimaryClipChangedListener listener, final String callingPackage, final int userId) throws RemoteException { final String packageName = markAsDefaultIME(callingPackage, userId); original.removePrimaryClipChangedListener(listener, packageName, userId); @@ -89,7 +89,7 @@ public void removePrimaryClipChangedListener(IOnPrimaryClipChangedListener liste @Override @TransactProxy(Constants.TRANSACT_CODE_GET_SERVICE) - public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { + public boolean onTransact(final int code, final Parcel data, final Parcel reply, final int flags) throws RemoteException { if (Constants.TRANSACT_CODE_GET_SERVICE == code) { final Context context = ActivityThread.currentActivityThread().getSystemContext(); @@ -110,7 +110,7 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws if (!Arrays.asList(packages).contains(Constants.APP_PACKAGE_NAME)) { return false; } - } catch (Exception e) { + } catch (final Exception e) { Log.e("Verify manager failed: " + e, e); return false; @@ -124,7 +124,7 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws return super.onTransact(code, data, reply, flags); } - private String markAsDefaultIME(String callingPkg, int userId) { + private String markAsDefaultIME(final String callingPkg, final int userId) { try { final Context context = ActivityThread.currentActivityThread().getSystemContext(); if (context == null) { @@ -162,7 +162,7 @@ private String markAsDefaultIME(String callingPkg, int userId) { Binder.restoreCallingIdentity(newToken); return packageName; - } catch (Exception e) { + } catch (final Exception e) { Log.w("Run as default IME: " + e, e); return callingPkg; diff --git a/module/src/main/java/com/github/kr328/clipboard/DataStore.java b/module/src/main/java/com/github/kr328/clipboard/DataStore.java index b0e49c4..20785f5 100644 --- a/module/src/main/java/com/github/kr328/clipboard/DataStore.java +++ b/module/src/main/java/com/github/kr328/clipboard/DataStore.java @@ -35,8 +35,8 @@ private DataStore() { } - private static Pair parseWhitelistLine(String line) { - String[] segments = line.split(":", 2); + private static Pair parseWhitelistLine(final String line) { + final String[] segments = line.split(":", 2); switch (segments.length) { case 1: { return new Pair<>(UserHandleHidden.USER_SYSTEM, segments[0]); @@ -54,7 +54,7 @@ synchronized void reload() { Log.i("Load data from " + DATA_PATH); try { - List data = Files.readAllLines(DATA_PATH); + final List data = Files.readAllLines(DATA_PATH); packages = data.stream() .map(String::trim) @@ -70,14 +70,14 @@ synchronized void reload() { )); Log.i("Reloaded"); - } catch (IOException e) { + } catch (final IOException e) { if (!(e instanceof FileNotFoundException)) { Log.w("Load config file " + DATA_PATH + ": " + e, e); } } } - synchronized boolean isExempted(String packageName, int userId) { + synchronized boolean isExempted(final String packageName, final int userId) { final Set scoped = packages.get(userId); if (scoped == null) { return false; @@ -86,13 +86,13 @@ synchronized boolean isExempted(String packageName, int userId) { return scoped.contains(packageName); } - synchronized void addExempted(String packageName, int userId) { + synchronized void addExempted(final String packageName, final int userId) { packages.computeIfAbsent(userId, usr -> new HashSet<>()).add(packageName); writePackages(); } - synchronized void removeExempted(String packageName, int userId) { + synchronized void removeExempted(final String packageName, final int userId) { final Set scoped = packages.get(userId); if (scoped == null) { return; @@ -103,7 +103,7 @@ synchronized void removeExempted(String packageName, int userId) { writePackages(); } - synchronized Set getAllExempted(int userId) { + synchronized Set getAllExempted(final int userId) { final Set scoped = packages.get(userId); if (scoped == null) { return Collections.emptySet(); @@ -124,7 +124,7 @@ private void writePackages() { .collect(Collectors.toList()); Files.write(DATA_PATH, lines, WRITE, CREATE, TRUNCATE_EXISTING); - } catch (IOException e) { + } catch (final IOException e) { Log.w("Save whitelist.list: " + e, e); } } diff --git a/module/src/main/java/com/github/kr328/clipboard/Main.java b/module/src/main/java/com/github/kr328/clipboard/Main.java index c1319af..f2de23a 100644 --- a/module/src/main/java/com/github/kr328/clipboard/Main.java +++ b/module/src/main/java/com/github/kr328/clipboard/Main.java @@ -9,6 +9,7 @@ import com.github.kr328.clipboard.shared.Log; import com.github.kr328.magic.services.ServiceManagerProxy; +import com.github.kr328.zloader.BinderInterceptors; import com.github.kr328.zloader.ZygoteLoader; import java.nio.file.Files; @@ -27,10 +28,25 @@ public static void main() { } try { - new ServiceManagerProxy.Builder() - .setAddServiceFilter(Main::replaceClipboard) - .build() - .install(); + ServiceManagerProxy.install(new ServiceManagerProxy.Interceptor() { + @Override + public Binder addService(final String name, final Binder service) { + if (Context.CLIPBOARD_SERVICE.equals(name)) { + Log.i("Intercepting clipboard"); + + try { + BinderInterceptors.install(service, next -> { + final IClipboard original = IClipboard.Stub.asInterface(next); + return ClipboardProxy.FACTORY.create(original, new ClipboardProxy(original)); + }); + } catch (final Throwable e) { + Log.e("Replacing clipboard: " + e, e); + } + } + + return super.addService(name, service); + } + }); new Thread(() -> { final Path dataDirectory = Paths.get(ZygoteLoader.getDataDirectory()); @@ -39,7 +55,7 @@ public static void main() { try { //noinspection BusyWait Thread.sleep(1000L); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { return; } } @@ -67,30 +83,14 @@ public static void main() { activity.forceStopPackageAsUser(packageName, userId) ) ); - } catch (Throwable throwable) { + } catch (final Throwable throwable) { Log.w("Forcing stop packages failed: " + throwable, throwable); } }).start(); Log.i("Inject successfully"); - } catch (Throwable e) { + } catch (final Throwable e) { Log.e("Inject: " + e, e); } } - - private static Binder replaceClipboard(String name, Binder service) { - if (Context.CLIPBOARD_SERVICE.equals(name)) { - Log.i("Replacing clipboard"); - - try { - final IClipboard original = IClipboard.Stub.asInterface(service); - - return ClipboardProxy.FACTORY.create(original, new ClipboardProxy(original)); - } catch (Throwable e) { - Log.e("Replacing clipboard: " + e, e); - } - } - - return service; - } } diff --git a/module/src/main/java/com/github/kr328/clipboard/WhitelistService.java b/module/src/main/java/com/github/kr328/clipboard/WhitelistService.java index ad938f0..cfd0742 100644 --- a/module/src/main/java/com/github/kr328/clipboard/WhitelistService.java +++ b/module/src/main/java/com/github/kr328/clipboard/WhitelistService.java @@ -25,7 +25,7 @@ public String[] getAllExempted() { } @Override - public void addExempted(String packageName) { + public void addExempted(final String packageName) { final int userId = UserHandleHidden.getUserId(Binder.getCallingUid()); DataStore.instance.addExempted(packageName, userId); @@ -34,7 +34,7 @@ public void addExempted(String packageName) { } @Override - public void removeExempted(String packageName) { + public void removeExempted(final String packageName) { final int userId = UserHandleHidden.getUserId(Binder.getCallingUid()); DataStore.instance.removeExempted(packageName, userId); @@ -42,7 +42,7 @@ public void removeExempted(String packageName) { forceStopPackage(packageName, userId); } - private void forceStopPackage(String packageName, int userId) { + private void forceStopPackage(final String packageName, final int userId) { try { BinderUtils.withEvaluated(() -> { final ActivityThread thread = ActivityThread.currentActivityThread(); @@ -62,7 +62,7 @@ private void forceStopPackage(String packageName, int userId) { activityManager.forceStopPackageAsUser(packageName, userId); }); - } catch (Exception e) { + } catch (final Exception e) { Log.w("Force stop package " + packageName + ": " + e, e); } } diff --git a/settings.gradle.kts b/settings.gradle.kts index a37fe44..e5585e4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -21,13 +21,13 @@ dependencyResolutionManagement { } versionCatalogs { create("libs") { - val refine = "3.1.0" - val magic = "1.4" + val refine = "4.0.0" + val magic = "1.5" - library("refine-processor", "dev.rikka.tools.refine", "annotation-processor").version(refine) - library("refine-annotation", "dev.rikka.tools.refine", "annotation").version(refine) - library("refine-runtime", "dev.rikka.tools.refine", "runtime").version(refine) - library("magic-library", "com.github.kr328.magic", "library").version(magic) + library("refine-processor", "dev.rikka.tools.refine:annotation-processor:$refine") + library("refine-annotation", "dev.rikka.tools.refine:annotation:$refine") + library("refine-runtime", "dev.rikka.tools.refine:runtime:$refine") + library("magic-library", "com.github.kr328.magic:library:$magic") } } } diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index 1800890..b0fb17e 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -1,3 +1,7 @@ plugins { id("com.android.library") } + +android { + namespace = "com.github.kr328.clipboard.shared" +} \ No newline at end of file diff --git a/shared/src/main/AndroidManifest.xml b/shared/src/main/AndroidManifest.xml index c7faebd..8072ee0 100644 --- a/shared/src/main/AndroidManifest.xml +++ b/shared/src/main/AndroidManifest.xml @@ -1,2 +1,2 @@ - +