Make AS happy (#672)

* Suppress error

* Register data binding generated files
This commit is contained in:
vvb2060 2021-05-25 11:03:01 +08:00 committed by GitHub
parent 6034d97e17
commit 7403a17b82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 7 deletions

View File

@ -22,10 +22,24 @@ import com.android.build.gradle.internal.dsl.BuildType
import java.nio.file.Paths import java.nio.file.Paths
plugins { plugins {
id("org.gradle.idea")
id("com.android.application") id("com.android.application")
kotlin("android") kotlin("android")
} }
// workaround for AS.
val dataBinding = file("${project.buildDir}/generated/data_binding_base_class_source_out/debug/out")
sourceSets {
create("dataBinding") {
java.srcDir(dataBinding)
}
}
idea {
module {
generatedSourceDirs.add(dataBinding)
}
}
val androidTargetSdkVersion: Int by rootProject.extra val androidTargetSdkVersion: Int by rootProject.extra
val androidMinSdkVersion: Int by rootProject.extra val androidMinSdkVersion: Int by rootProject.extra
val androidBuildToolsVersion: String by rootProject.extra val androidBuildToolsVersion: String by rootProject.extra
@ -229,4 +243,3 @@ configurations.all {
exclude(group = "androidx.appcompat", module = "appcompat") exclude(group = "androidx.appcompat", module = "appcompat")
} }
} }

View File

@ -124,8 +124,8 @@ public class ConfigManager {
private boolean sepolicyLoaded = true; private boolean sepolicyLoaded = true;
static class ProcessScope { static class ProcessScope {
String processName; final String processName;
int uid; final int uid;
ProcessScope(@NonNull String processName, int uid) { ProcessScope(@NonNull String processName, int uid) {
this.processName = processName; this.processName = processName;
@ -367,6 +367,7 @@ public class ConfigManager {
obsoleteScopes.add(module); obsoleteScopes.add(module);
} else { } else {
var info = pkgInfo.get(userId); var info = pkgInfo.get(userId);
assert info != null;
cachedModule.computeIfAbsent(info.applicationInfo.uid % PER_USER_RANGE, k -> info.packageName); cachedModule.computeIfAbsent(info.applicationInfo.uid % PER_USER_RANGE, k -> info.packageName);
} }
} }
@ -436,9 +437,7 @@ public class ConfigManager {
Log.d(TAG, "cached Scope"); Log.d(TAG, "cached Scope");
cachedScope.forEach((ps, module) -> { cachedScope.forEach((ps, module) -> {
Log.d(TAG, ps.processName + "/" + ps.uid); Log.d(TAG, ps.processName + "/" + ps.uid);
module.forEach((pkg_name, apk_path) -> { module.forEach((pkg_name, apk_path) -> Log.d(TAG, "\t" + pkg_name));
Log.d(TAG, "\t" + pkg_name);
});
}); });
} }
@ -508,7 +507,7 @@ public class ConfigManager {
if (cursor == null) return -1; if (cursor == null) return -1;
if (cursor.getCount() != 1) return -1; if (cursor.getCount() != 1) return -1;
cursor.moveToFirst(); cursor.moveToFirst();
return cursor.getInt(cursor.getColumnIndex("mid")); return cursor.getInt(cursor.getColumnIndexOrThrow("mid"));
} }
} }