Skip to content

Commit

Permalink
UPDATE: Minor tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
oasisfeng committed Jun 13, 2020
1 parent 0520e59 commit 56b858b
Show file tree
Hide file tree
Showing 20 changed files with 43 additions and 59 deletions.
4 changes: 2 additions & 2 deletions assembly/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ android {
defaultConfig {
applicationId "com.oasisfeng.island"
minSdkVersion 21
targetSdkVersion 28 // Module "fileprovider" indirectly accessed private APIs in dark greylist, via loaded remote class.
targetSdkVersion 28 // Private APIs are accessed by module "open" and "fileprovider" (via indirectly loaded remote class)
resConfigs "en", "zh"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}

dataBinding.enabled true
buildFeatures.dataBinding true

buildTypes {
release {
Expand Down
2 changes: 1 addition & 1 deletion biometric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ android {

dependencies {
implementation project(path: ':deagle') // class LifecycleActivity
implementation 'androidx.lifecycle:lifecycle-common-java8:2.0.0'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.2.0'
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.31.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
Expand Down
4 changes: 1 addition & 3 deletions engine/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion this.compileSdkVersion
Expand Down Expand Up @@ -29,8 +28,7 @@ dependencies {
implementation project(':shared')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutine_version"
implementation 'androidx.core:core:1.0.2' // ShortcutShuttle
implementation "androidx.core:core-ktx:1.0.2"
implementation 'androidx.core:core:1.3.0' // ShortcutShuttle

androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
Expand Down
2 changes: 1 addition & 1 deletion engine/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@

<receiver android:name="com.oasisfeng.island.shuttle.ShortcutShuttle" tools:ignore="ExportedReceiver"> <!-- Exported without permission requirement, for wider compatibility -->
<intent-filter>
<action android:name="com.android.launcher.action.INSTALL_SHORTCUT"/>
<action android:name="com.android.launcher.action.INSTALL_SHORTCUT" />
</intent-filter>
</receiver>

Expand Down
4 changes: 2 additions & 2 deletions fileprovider/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ android.libraryVariants.all { variant ->

dependencies {
implementation project(':shared')
implementation 'androidx.annotation:annotation:1.0.1'
implementation 'androidx.annotation:annotation:1.1.0'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
}
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

# Disable instrumentation by Firebase Performance
android.enableJetifier=true
android.useAndroidX=true

# Disable instrumentation by Firebase Performance
firebasePerformanceInstrumentationEnabled=false
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 @@
#Tue Dec 10 16:19:32 CST 2019
#Fri May 29 02:19:04 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
2 changes: 1 addition & 1 deletion installer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private Intent buildTargetIntent(final String pkg, final @Nullable UserHandle us
final int flags = SDK_INT >= N ? PackageManager.MATCH_SYSTEM_ONLY : 0;
try {
final List<ResolveInfo> app_detail_resolves = pm.queryIntentActivities(app_detail, flags);
app_detail_resolve = app_detail_resolves == null || app_detail_resolves.isEmpty() ? null : app_detail_resolves.get(0);
app_detail_resolve = app_detail_resolves.isEmpty() ? null : app_detail_resolves.get(0);
} catch (final NullPointerException e) { // Huawei-specific issue, only reported on Android 8
app_detail_resolve = pm.resolveActivity(app_detail, flags);
}
Expand Down Expand Up @@ -104,19 +104,17 @@ private Intent buildTargetIntent(final String pkg, final @Nullable UserHandle us
final Intent market_intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + pkg));
final List<ResolveInfo> market_apps = getPackageManager().queryIntentActivities(market_intent, 0);
final List<ComponentName> exclude_components = new ArrayList<>();
if (market_apps != null) {
stream(market_apps).map(r -> r.activityInfo).filter(ai -> ! ai.packageName.equals(caller)).forEachOrdered(market_activity -> {
final Optional<ActivityInfo> dup_target = stream(target_resolves.get()).map(r -> r.activityInfo).filter(target_activity ->
market_activity.packageName.equals(target_activity.packageName) && market_activity.labelRes == target_activity.labelRes
&& TextUtils.equals(market_activity.nonLocalizedLabel, target_activity.nonLocalizedLabel)).findFirst();
if (dup_target.isPresent()) {
if (SDK_INT < N) return; // Let alone in target list, due to EXTRA_EXCLUDE_COMPONENTS not supported before Android N.
final ActivityInfo dup_target_activity = dup_target.get();
exclude_components.add(new ComponentName(dup_target_activity.packageName, dup_target_activity.name));
}
initial_intents.add(new Intent(market_intent).setClassName(market_activity.packageName, market_activity.name));
});
}
stream(market_apps).map(r -> r.activityInfo).filter(ai -> ! ai.packageName.equals(caller)).forEachOrdered(market_activity -> {
final Optional<ActivityInfo> dup_target = stream(target_resolves.get()).map(r -> r.activityInfo).filter(target_activity ->
market_activity.packageName.equals(target_activity.packageName) && market_activity.labelRes == target_activity.labelRes
&& TextUtils.equals(market_activity.nonLocalizedLabel, target_activity.nonLocalizedLabel)).findFirst();
if (dup_target.isPresent()) {
if (SDK_INT < N) return; // Let alone in target list, due to EXTRA_EXCLUDE_COMPONENTS not supported before Android N.
final ActivityInfo dup_target_activity = dup_target.get();
exclude_components.add(new ComponentName(dup_target_activity.packageName, dup_target_activity.name));
}
initial_intents.add(new Intent(market_intent).setClassName(market_activity.packageName, market_activity.name));
});
if (SDK_INT >= N) {
if (! caller_is_settings && isCallerIslandButNotForwarder(caller))
exclude_components.add(new ComponentName(this, AppInfoForwarderActivity.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
import android.widget.CheckBox;
import android.widget.Toast;

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

import com.oasisfeng.android.ui.Dialogs;
import com.oasisfeng.android.util.Apps;
import com.oasisfeng.android.util.Supplier;
Expand All @@ -59,8 +62,6 @@
import java.util.Map;
import java.util.Set;

import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import java9.util.Optional;

import static android.Manifest.permission.MANAGE_DOCUMENTS;
Expand Down Expand Up @@ -397,7 +398,7 @@ private boolean declaresRequestInstallPermission(final String pkg) {
unregisterReceiver(this);
if (mResultNeeded) // Implement the exact same result data as InstallSuccess in PackageInstaller
activity.setResult(Activity.RESULT_OK, new Intent().putExtra(EXTRA_INSTALL_RESULT, INSTALL_SUCCEEDED));
AppInstallationNotifier.onPackageInstalled(context, mCallerPackage, mCallerAppLabel.get(), pkg);
if (pkg != null) AppInstallationNotifier.onPackageInstalled(context, mCallerPackage, mCallerAppLabel.get(), pkg, Users.current());
finish();
break;
case PackageInstaller.STATUS_PENDING_USER_ACTION:
Expand Down
2 changes: 1 addition & 1 deletion mobile/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}

dataBinding.enabled true
buildFeatures.dataBinding true

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
14 changes: 0 additions & 14 deletions mobile/src/main/java/com/oasisfeng/island/TempDebug.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static void toggleAdbSecure(final LifecycleActivity activity, final boole
private static void showPromptForAdbSecureProtection(final LifecycleActivity activity, final boolean enabled) {
if (SDK_INT < M || ! enabled || activity.isDestroyed()) return;
if (isAdbSecureProtected(activity)) Snackbars.make(activity, R.string.prompt_security_confirmation_activated)
.setAction(R.string.action_deactivate, v -> disableSecurityConfirmationForAdbSecure(activity)).show();
.setDuration(3_000).setAction(R.string.action_deactivate, v -> disableSecurityConfirmationForAdbSecure(activity)).show();
else Snackbars.make(activity, R.string.prompt_security_confirmation_suggestion)
.setAction(R.string.action_activate, v -> enableSecurityConfirmationForAdbSecure(activity)).show();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import com.oasisfeng.island.util.Hacks
apps[which].also { if (checked) it.restore() else it.revoke() }
}.setNeutralButton(R.string.action_revoke_all) { _, _ ->
Dialogs.buildAlert(activity, R.string.dialog_title_warning, R.string.prompt_appops_revoke_for_all_users_apps)
.withOkButton { apps.forEach { if (!it.mSystem) it.revoke() } }
.withOkButton { apps.forEach { if (! it.mSystem) it.revoke() } }
.withCancelButton().show()
}.setPositiveButton(R.string.action_done) { _,_ -> AsyncTask.execute {
syncPermissionsLockedStateForApps(op, apps.map { it.pkg }) } // To migrate legacy ops without permission lock
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION")

package com.oasisfeng.island.settings

import android.os.Build.VERSION.SDK_INT
Expand All @@ -7,10 +9,7 @@ import android.preference.PreferenceGroup
import android.preference.TwoStatePreference
import androidx.annotation.StringRes

/**
* Created by Oasis on 2019-10-13.
*/
@Suppress("DEPRECATION") inline fun <T: Preference> android.preference.PreferenceFragment.setup(@StringRes key: Int, crossinline block: T.() -> Unit)
inline fun <T: Preference> android.preference.PreferenceFragment.setup(@StringRes key: Int, crossinline block: T.() -> Unit)
= @Suppress("UNCHECKED_CAST") (findPreference(getString(key)) as? T)?.apply { block() }

@Suppress("DEPRECATION") fun android.preference.PreferenceFragment.remove(preference: Preference) {
Expand Down
2 changes: 1 addition & 1 deletion shared/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dependencies {
implementation 'com.google.firebase:firebase-core:16.0.6'
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.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.oasisfeng.condom:library:2.5.0'

testImplementation 'junit:junit:4.12'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import android.os.RemoteException;
import android.util.Log;

import androidx.annotation.Nullable;

import com.oasisfeng.android.service.AidlService;
import com.oasisfeng.android.service.Services;

Expand All @@ -15,7 +17,6 @@
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;

import androidx.annotation.Nullable;
import java9.util.concurrent.CompletableFuture;
import java9.util.concurrent.CompletionStage;

Expand Down Expand Up @@ -56,7 +57,7 @@ public static CompletionStage<Void> runInProfile(final Context context, final Ge
private static <Result> CompletionStage<Result> shuttle(final Context context, final ShuttleMethod lambda) {
final Class<?> clazz = lambda.getClass();
final Constructor<?>[] constructors = clazz.getDeclaredConstructors();
if (constructors == null || constructors.length < 1) throw new IllegalArgumentException("The method must have at least one constructor");
if (constructors.length < 1) throw new IllegalArgumentException("The method must have at least one constructor");
final Constructor<?> constructor = constructors[0]; // Extra constructor may be generated by "Instant Run" of Android Studio.
final Class<?>[] constructor_params = constructor.getParameterTypes();

Expand Down
6 changes: 3 additions & 3 deletions shared/src/main/java/com/oasisfeng/island/util/Hacks.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public class Hacks {
int getMode();
}

@Hack.Fallback(-1) int checkOpNoThrow(final int op, final int uid, final String pkg);
@Hack.Fallback(-1) int checkOpNoThrow(int op, int uid, String pkg);
@Nullable List<PackageOps> getOpsForPackage(int uid, String pkg, @Nullable int[] ops);
@Nullable List<PackageOps> getPackagesForOps(@Nullable int[] ops);
void setMode(int code, int uid, String packageName, int mode);
Expand All @@ -174,9 +174,9 @@ public class Hacks {
@Nullable String opToPermission(int op);
}

public interface UserManagerHack extends Hack.Mirror<UserManager> {
@Keep public interface UserManagerHack extends Hack.Mirror<UserManager> {

@Hack.SourceClass("android.content.pm.UserInfo") interface UserInfo extends Hack.Mirror {
@Keep @Hack.SourceClass("android.content.pm.UserInfo") interface UserInfo extends Hack.Mirror {
int getId();
UserHandle getUserHandle();
}
Expand Down
2 changes: 1 addition & 1 deletion watcher/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ dependencies {
implementation project(':shared')

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
}

0 comments on commit 56b858b

Please sign in to comment.