Skip to content

Commit

Permalink
UPDATE: Minor tweaks and fixes.
Browse files Browse the repository at this point in the history
* Module type switched to "library". ("feature" is deprecated)
* Upgrade Gradle, Android Gradle build plug-in and various libraries.
* Unify compileSdkVersion across modules and increase it to 29.
  • Loading branch information
oasisfeng committed Apr 29, 2020
1 parent 1b78a15 commit f206a00
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 47 deletions.
2 changes: 1 addition & 1 deletion assembly/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
compileSdkVersion 28
compileSdkVersion this.compileSdkVersion

defaultConfig {
applicationId "com.oasisfeng.island"
Expand Down
2 changes: 1 addition & 1 deletion biometric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 28
compileSdkVersion this.compileSdkVersion

defaultConfig {
minSdkVersion 21
Expand Down
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.3.72'
ext.kotlin_coroutine_version = '1.3.1'
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.26.0'
classpath 'io.fabric.tools:gradle:1.31.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -26,4 +26,6 @@ allprojects {
jcenter()
google()
}

ext.compileSdkVersion = 29
}
4 changes: 2 additions & 2 deletions engine/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apply plugin: 'com.android.feature'
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 28
compileSdkVersion this.compileSdkVersion

defaultConfig {
minSdkVersion 21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ import com.oasisfeng.island.util.Users
if (pkgs.size == 1 && pkgs[0] == pkg) Toast.makeText(context, "QUERY_PACKAGE_RESTART: $pkg", Toast.LENGTH_LONG).show()
}}

override fun onDestroy() {
if (applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE == 0) return // TODO: Remove before release
try { unregisterReceiver(mPackageRestartQueryReceiver) } catch (e: IllegalArgumentException) {}
getSystemService(AppOpsManager::class.java).stopWatchingMode(mListener)
}

private val mHandler = Handler(Looper.getMainLooper())
private val mListener = AppOpsManager.OnOpChangedListener { op, pkg ->
mHandler.post { Toast.makeText(this@IslandPersistentService, "Changed: $op - $pkg", Toast.LENGTH_LONG).show() }}
Expand Down
4 changes: 2 additions & 2 deletions fileprovider/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.feature'
apply plugin: 'com.android.library'

android {
compileSdkVersion 28
compileSdkVersion this.compileSdkVersion

defaultConfig {
minSdkVersion 21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
import android.provider.DocumentsContract;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;

import com.oasisfeng.android.util.Supplier;
import com.oasisfeng.island.analytics.Analytics;
import com.oasisfeng.island.util.Users;
Expand All @@ -38,10 +42,6 @@
import java.util.List;
import java.util.Objects;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;

import static android.Manifest.permission.MANAGE_DOCUMENTS;
import static android.content.Context.CONTEXT_IGNORE_SECURITY;
import static android.content.Context.CONTEXT_INCLUDE_CODE;
Expand Down Expand Up @@ -240,6 +240,7 @@ private Context wrapWithResolverWrapper(final Context context) {
.with(ITEM_ID, Proxy.getInvocationHandler(content_service).getClass().getCanonicalName()).send();

final Context context = context().createPackageContext(target_provider.packageName, CONTEXT_INCLUDE_CODE | CONTEXT_IGNORE_SECURITY);
Log.d(TAG, "Initializing " + target_provider.name);
@SuppressLint("PrivateApi") final Class<?> ExternalStorageProvider = context.getClassLoader().loadClass(target_provider.name);
mDelegate = (ContentProvider) ExternalStorageProvider.newInstance();
mDelegate.attachInfo(wrapWithResolverWrapper(context), target_provider);
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Jan 16 20:04:48 CST 2019
#Tue Dec 10 16:19:32 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
4 changes: 2 additions & 2 deletions installer/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.feature'
apply plugin: 'com.android.library'

android {
compileSdkVersion 28
compileSdkVersion this.compileSdkVersion

defaultConfig {
minSdkVersion 21
Expand Down
25 changes: 8 additions & 17 deletions mobile/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
apply plugin: 'com.android.feature'
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 28
compileSdkVersion this.compileSdkVersion

defaultConfig {
minSdkVersion 21
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}

baseFeature true

dataBinding.enabled true

compileOptions {
Expand All @@ -29,13 +26,6 @@ android {
}

dependencies {
application project(':assembly')
feature project(':engine')
feature project(':fileprovider')
feature project(':installer')
feature project(":watcher")
feature project(":open")

implementation fileTree(dir: 'libs', include: ['*.aar'])
implementation project(':shared')
implementation project(':deagle')
Expand All @@ -44,11 +34,12 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutine_version"
implementation 'androidx.lifecycle:lifecycle-common-java8:2.0.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.firebase:firebase-appindexing:19.0.0' // FeatureActionActivity
implementation 'eu.chainfire:libsuperuser:1.0.0.201510071325'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class GeneralPreferenceFragment : SettingsActivity.SubPreferenceFragment(R.xml.p
if (Permissions.has(activity, GET_APP_OPS_STATS)) lock(true)
else Dialogs.buildAlert(activity, null, getString(R.string.prompt_adb_app_ops_command) + "\n\n" + cmd)
.withOkButton(null).setNeutralButton(R.string.action_copy) { _,_ ->
(activity.getSystemService(CLIPBOARD_SERVICE) as ClipboardManager).primaryClip = ClipData.newPlainText(null, cmd)
val cm = activity.getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
cm.setPrimaryClip(ClipData.newPlainText(null, cmd))
}.show()
}}
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class IslandSettingsActivity: Activity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
title = intent?.getStringExtra(Intent.EXTRA_TITLE)
?: getString(R.string.tab_island).let { if (Users.current() == Users.profile) it else "it (${Users.current()})"}
?: getString(R.string.tab_island).let { if (Users.current() == Users.profile) it else "$it (${Users.toId(Users.current())})"}
@Suppress("DEPRECATION") fragmentManager.beginTransaction().replace(android.R.id.content, IslandSettingsFragment()).commit()
}

Expand Down
5 changes: 2 additions & 3 deletions open/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
apply plugin: 'com.android.feature'
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 28
compileSdkVersion this.compileSdkVersion

defaultConfig {
minSdkVersion 21
Expand Down
5 changes: 3 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include 'shared', ':legacy', 'engine', ':mobile', 'fileprovider', 'installer', ':biometric', ':watcher', ':open', 'assembly', ':deagle'
project(':deagle').projectDir = new File(settingsDir, '../deagle/library')
include 'shared', 'legacy', 'engine', 'mobile', 'fileprovider', 'installer', 'biometric', 'watcher', 'open'
include 'assembly'
include ':deagle'; project(':deagle').projectDir = new File(settingsDir, '../deagle/library')
8 changes: 4 additions & 4 deletions shared/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'com.android.feature'
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
Expand Down Expand Up @@ -44,8 +44,8 @@ android {
dependencies {
api project(':deagle')
api 'com.google.code.findbugs:jsr305:3.0.2'
api 'net.sourceforge.streamsupport:android-retrostreams:1.7.0'
api 'net.sourceforge.streamsupport:android-retrofuture:1.7.0'
api 'net.sourceforge.streamsupport:android-retrostreams:1.7.1'
api 'net.sourceforge.streamsupport:android-retrofuture:1.7.1'
implementation project(':legacy')
implementation 'org.jetbrains:annotations:15.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
Expand All @@ -54,7 +54,7 @@ dependencies {
implementation 'com.google.firebase:firebase-analytics:16.0.6'
implementation 'com.google.firebase:firebase-config:16.1.3'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
implementation 'com.oasisfeng.condom:library:2.3.1'
implementation 'com.oasisfeng.condom:library:2.5.0'

testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.18.3'
Expand Down
4 changes: 2 additions & 2 deletions watcher/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.feature'
apply plugin: 'com.android.library'

android {
compileSdkVersion 28
compileSdkVersion this.compileSdkVersion

defaultConfig {
minSdkVersion 21
Expand Down

0 comments on commit f206a00

Please sign in to comment.