├── app
├── .gitignore
├── src
│ └── main
│ │ ├── assets
│ │ └── xposed_init
│ │ ├── res
│ │ ├── drawable-hdpi
│ │ │ └── ic_nlp_app.png
│ │ ├── drawable-mdpi
│ │ │ └── ic_nlp_app.png
│ │ ├── drawable-xhdpi
│ │ │ └── ic_nlp_app.png
│ │ ├── drawable-xxhdpi
│ │ │ └── ic_nlp_app.png
│ │ ├── values
│ │ │ ├── dimens.xml
│ │ │ └── strings.xml
│ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ ├── menu
│ │ │ └── menu_settings.xml
│ │ └── layout
│ │ │ └── activity_settings.xml
│ │ ├── java
│ │ └── be
│ │ │ └── r3w6
│ │ │ └── xposedunifiednlp
│ │ │ ├── PackageCheckStep.java
│ │ │ ├── CheckStep.java
│ │ │ ├── NetworkLocationCheckStep.java
│ │ │ ├── UnifiedNlp.java
│ │ │ ├── LocationCheckStep.java
│ │ │ └── Settings.java
│ │ └── AndroidManifest.xml
├── libs
│ └── XposedBridgeApi-54.jar
├── proguard-rules.pro
├── build.gradle
└── manifest-merger-release-report.txt
├── settings.gradle
├── .gitignore
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── README.md
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/app/src/main/assets/xposed_init:
--------------------------------------------------------------------------------
1 | be.r3w6.xposedunifiednlp.UnifiedNlp
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea
4 | .DS_Store
5 | /build
6 | *.iml
7 | *.ipr
8 | *.iws
9 | *.apk
--------------------------------------------------------------------------------
/app/libs/XposedBridgeApi-54.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Intika-Android-Apps/XposedGmsCoreUnifiedNlp/HEAD/app/libs/XposedBridgeApi-54.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Intika-Android-Apps/XposedGmsCoreUnifiedNlp/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_nlp_app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Intika-Android-Apps/XposedGmsCoreUnifiedNlp/HEAD/app/src/main/res/drawable-hdpi/ic_nlp_app.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_nlp_app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Intika-Android-Apps/XposedGmsCoreUnifiedNlp/HEAD/app/src/main/res/drawable-mdpi/ic_nlp_app.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_nlp_app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Intika-Android-Apps/XposedGmsCoreUnifiedNlp/HEAD/app/src/main/res/drawable-xhdpi/ic_nlp_app.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_nlp_app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Intika-Android-Apps/XposedGmsCoreUnifiedNlp/HEAD/app/src/main/res/drawable-xxhdpi/ic_nlp_app.png
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 10 15:27:10 PDT 2013
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_settings.xml:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | XposedGmsCoreUnifiedNlp
5 | Settings
6 | Hello world!
7 | Settings
8 | Check Settings
9 | Checking...
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\adt-bundle-windows-x86_64-20140321\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle context.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle context configured through the IDE *will override*
5 | # any context specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory context.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/app/src/main/java/be/r3w6/xposedunifiednlp/PackageCheckStep.java:
--------------------------------------------------------------------------------
1 | package be.r3w6.xposedunifiednlp;
2 |
3 | import android.content.Context;
4 | import android.content.pm.PackageManager;
5 |
6 | /**
7 | * Created on 13.02.2015.
8 | */
9 | class PackageCheckStep extends CheckStep {
10 | private Context context;
11 |
12 | public PackageCheckStep(Context context) {
13 | super("UnifiedNlp package");
14 | this.context = context;
15 | }
16 |
17 | @Override
18 | public void runStep() {
19 | try {
20 | context.getPackageManager().getPackageInfo("com.google.android.gms", PackageManager.GET_ACTIVITIES);
21 | setState(StepState.SUCCESS);
22 | } catch (PackageManager.NameNotFoundException e) {
23 | setState(StepState.FAIL);
24 | }
25 | }
26 |
27 | @Override
28 | public String getSolution() {
29 | return "Please download and install the latest UnifiedNlp.apk from the UnifiedNlp release page.";
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/be/r3w6/xposedunifiednlp/CheckStep.java:
--------------------------------------------------------------------------------
1 | package be.r3w6.xposedunifiednlp;
2 |
3 | import android.util.Log;
4 |
5 | /**
6 | * Created on 13.02.2015.
7 | */
8 | public abstract class CheckStep {
9 | public CheckStep(String name) {
10 | this.name = name;
11 | }
12 |
13 | protected abstract void runStep();
14 |
15 | private String name;
16 | private StepState state = StepState.WAIT;
17 | private String solution;
18 |
19 | public String getName() {
20 | return name;
21 | }
22 |
23 | public StepState getState() {
24 | return state;
25 | }
26 |
27 | protected void setState(StepState state) {
28 | Log.i("CheckStep", getName() + "s state changed to " + state);
29 | this.state = state;
30 | }
31 |
32 | public void setSolution(String solution) {
33 | this.solution = solution;
34 | }
35 | public String getSolution() {
36 | if(solution == null)
37 | return "No known solution";
38 | return solution;
39 | }
40 |
41 | public enum StepState {
42 | WAIT,
43 | SUCCESS,
44 | FAIL,
45 | RUNNING, SKIPPED
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | apply plugin: 'com.android.application'
16 |
17 | android {
18 | compileSdkVersion 27
19 | defaultConfig {
20 | applicationId "be.r3w6.intika.xposedunifiednlp"
21 | minSdkVersion 15
22 | targetSdkVersion 25
23 | versionCode 4
24 | versionName "1.0.4-Beta-AndroidN"
25 | }
26 | buildTypes {
27 | release {
28 | }
29 | }
30 | buildToolsVersion '26.0.2'
31 | }
32 |
33 | dependencies {
34 | compileOnly fileTree(include: ['*.jar'], dir: 'libs')
35 | compile 'com.android.support:appcompat-v7:27.0.2'
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/be/r3w6/xposedunifiednlp/NetworkLocationCheckStep.java:
--------------------------------------------------------------------------------
1 | package be.r3w6.xposedunifiednlp;
2 |
3 | import android.content.Context;
4 | import android.location.LocationManager;
5 |
6 | /**
7 | * Created on 13.02.2015.
8 | */
9 | class NetworkLocationCheckStep extends CheckStep {
10 | private Context context;
11 |
12 | public NetworkLocationCheckStep(Context context) {
13 | super("Network-based geolocation");
14 | this.context = context;
15 | }
16 |
17 | @Override
18 | public void runStep() {
19 | LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
20 | if(locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
21 | setState(StepState.SUCCESS);
22 | } else {
23 | setState(StepState.FAIL);
24 | }
25 | }
26 |
27 | @Override
28 | public String getSolution() {
29 | return "Please activate network-based geolocation in Settings->Location. Since KitKat, you need to select any mode but \"device only\", on older Android version this setting is called \"Wi-Fi & mobile network location\" (ignore any misleading texts saying this is for Google's location service)";
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
14 |
17 |
20 |
23 |
24 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
19 |
20 |
30 |
31 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | XposedGmsCoreUnifiedNlp
2 | -
3 |
4 | Xposed module to integrate MicroG Services Core [MicroG UnifiedNlp](https://github.com/microg/android_packages_apps_GmsCore) into the system even if GAPPS are installed.
5 |
6 | All Cradit to Rawi01 and MaR-V-iN a huge thanks !!!!
7 |
8 | Installation
9 | ---
10 | 1. Download and install `GMSCore.apk` from the UnifiedNlp [release page](https://github.com/microg/android_packages_apps_GmsCore/releases)
11 | 2. Download and install one or more [backends](https://github.com/microg/android_packages_apps_UnifiedNlp#usage)
12 | 3. Download and install this module
13 | 4. Restart
14 | 5. Done
15 |
16 |
17 | ### How do I know it's running
18 |
19 | If you use the experimental module you can open the module settings and press the "Check settings" button. It will check if everything works as intended.
20 | Otherwise have a look at [#1](https://github.com/Rawi01/XposedUnifiedNlp/issues/1).
21 |
22 | ### It doesn't work
23 |
24 | Check that you
25 | * activated the backends in MicroG Settings
26 | * activated network-based geolocation in Settings->Location
27 |
28 | If you followed the instructions above and it still does not work, feel free to open an issue.
29 |
30 | License
31 | ---
32 | Licensed under the Apache License, Version 2.0 (the "License");
33 | you may not use this file except in compliance with the License.
34 | You may obtain a copy of the License at
35 |
36 | http://www.apache.org/licenses/LICENSE-2.0
37 |
38 | Unless required by applicable law or agreed to in writing, software
39 | distributed under the License is distributed on an "AS IS" BASIS,
40 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
41 | See the License for the specific language governing permissions and
42 | limitations under the License.
43 |
--------------------------------------------------------------------------------
/app/src/main/java/be/r3w6/xposedunifiednlp/UnifiedNlp.java:
--------------------------------------------------------------------------------
1 | package be.r3w6.xposedunifiednlp;
2 |
3 | import android.content.pm.ApplicationInfo;
4 | import android.content.pm.PackageManager;
5 | import android.content.pm.ResolveInfo;
6 |
7 | import android.content.res.XResources;
8 | import android.os.Build;
9 | import android.os.UserHandle;
10 |
11 | import de.robv.android.xposed.IXposedHookLoadPackage;
12 | import de.robv.android.xposed.IXposedHookZygoteInit;
13 | import de.robv.android.xposed.XC_MethodHook;
14 | import de.robv.android.xposed.XposedBridge;
15 | import de.robv.android.xposed.XposedHelpers;
16 | import de.robv.android.xposed.callbacks.XC_LoadPackage;
17 |
18 | public class UnifiedNlp implements IXposedHookZygoteInit, IXposedHookLoadPackage {
19 |
20 | @Override
21 | public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
22 | XResources.setSystemWideReplacement("android", "bool", "config_enableNetworkLocationOverlay", false);
23 | XResources.setSystemWideReplacement("android", "string", "config_networkLocationProviderPackageName", "com.google.android.gms");
24 | XResources.setSystemWideReplacement("android", "bool", "config_enableGeocoderOverlay", false);
25 | XResources.setSystemWideReplacement("android", "string", "config_geocoderProviderPackageName", "com.google.android.gms");
26 | XposedBridge.log("UnifiedNlp config set");
27 | }
28 |
29 | @Override
30 | public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
31 | if(!lpparam.packageName.equals("com.android.settings"))
32 | return;
33 |
34 | XC_MethodHook methodHook = new XC_MethodHook() {
35 | @Override
36 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
37 | ResolveInfo ri = (ResolveInfo) param.args[0];
38 | ri.serviceInfo.applicationInfo.flags |= ApplicationInfo.FLAG_SYSTEM;
39 | }
40 | };
41 |
42 | if(Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) {
43 | XposedHelpers.findAndHookMethod("com.android.settings.location.SettingsInjector", lpparam.classLoader, "parseServiceInfo", ResolveInfo.class, PackageManager.class, methodHook);
44 | } else {
45 | XposedHelpers.findAndHookMethod("com.android.settings.location.SettingsInjector", lpparam.classLoader, "parseServiceInfo", ResolveInfo.class, UserHandle.class, PackageManager.class, methodHook);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/app/manifest-merger-release-report.txt:
--------------------------------------------------------------------------------
1 | -- Merging decision tree log ---
2 | manifest
3 | ADDED from AndroidManifest.xml:2:1
4 | xmlns:android
5 | ADDED from AndroidManifest.xml:2:11
6 | package
7 | ADDED from AndroidManifest.xml:3:5
8 | INJECTED from AndroidManifest.xml:0:0
9 | INJECTED from AndroidManifest.xml:0:0
10 | android:versionName
11 | INJECTED from AndroidManifest.xml:0:0
12 | INJECTED from AndroidManifest.xml:0:0
13 | android:versionCode
14 | INJECTED from AndroidManifest.xml:0:0
15 | INJECTED from AndroidManifest.xml:0:0
16 | uses-permission#android.permission.ACCESS_COARSE_LOCATION
17 | ADDED from AndroidManifest.xml:5:5
18 | android:name
19 | ADDED from AndroidManifest.xml:5:22
20 | uses-permission#android.permission.ACCESS_FINE_LOCATION
21 | ADDED from AndroidManifest.xml:6:5
22 | android:name
23 | ADDED from AndroidManifest.xml:6:22
24 | uses-permission#android.permission.ACCESS_WIFI_STATE
25 | ADDED from AndroidManifest.xml:7:5
26 | android:name
27 | ADDED from AndroidManifest.xml:7:22
28 | uses-permission#android.permission.CHANGE_WIFI_STATE
29 | ADDED from AndroidManifest.xml:8:5
30 | android:name
31 | ADDED from AndroidManifest.xml:8:22
32 | application
33 | ADDED from AndroidManifest.xml:10:5
34 | MERGED from com.android.support:support-v4:21.0.3:16:5
35 | android:label
36 | ADDED from AndroidManifest.xml:13:9
37 | android:allowBackup
38 | ADDED from AndroidManifest.xml:11:9
39 | android:icon
40 | ADDED from AndroidManifest.xml:12:9
41 | meta-data#xposedmodule
42 | ADDED from AndroidManifest.xml:14:9
43 | android:name
44 | ADDED from AndroidManifest.xml:15:13
45 | android:value
46 | ADDED from AndroidManifest.xml:16:13
47 | meta-data#xposeddescription
48 | ADDED from AndroidManifest.xml:17:9
49 | android:name
50 | ADDED from AndroidManifest.xml:18:13
51 | android:value
52 | ADDED from AndroidManifest.xml:19:13
53 | meta-data#xposedminversion
54 | ADDED from AndroidManifest.xml:20:9
55 | android:name
56 | ADDED from AndroidManifest.xml:21:13
57 | android:value
58 | ADDED from AndroidManifest.xml:22:13
59 | activity#be.r3w6.xposedunifiednlp.Settings
60 | ADDED from AndroidManifest.xml:24:9
61 | android:label
62 | ADDED from AndroidManifest.xml:26:13
63 | android:name
64 | ADDED from AndroidManifest.xml:25:13
65 | intent-filter#android.intent.action.MAIN+de.robv.android.xposed.category.MODULE_SETTINGS
66 | ADDED from AndroidManifest.xml:27:13
67 | action#android.intent.action.MAIN
68 | ADDED from AndroidManifest.xml:28:17
69 | android:name
70 | ADDED from AndroidManifest.xml:28:25
71 | category#de.robv.android.xposed.category.MODULE_SETTINGS
72 | ADDED from AndroidManifest.xml:29:17
73 | android:name
74 | ADDED from AndroidManifest.xml:29:27
75 | uses-sdk
76 | INJECTED from AndroidManifest.xml:0:0 reason: use-sdk injection requested
77 | MERGED from com.android.support:support-v4:21.0.3:15:5
78 | android:targetSdkVersion
79 | INJECTED from AndroidManifest.xml:0:0
80 | INJECTED from AndroidManifest.xml:0:0
81 | android:minSdkVersion
82 | INJECTED from AndroidManifest.xml:0:0
83 | INJECTED from AndroidManifest.xml:0:0
84 |
--------------------------------------------------------------------------------
/app/src/main/java/be/r3w6/xposedunifiednlp/LocationCheckStep.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package be.r3w6.xposedunifiednlp;
16 |
17 | import android.content.Context;
18 | import android.content.pm.PackageManager;
19 | import android.location.Location;
20 | import android.location.LocationListener;
21 | import android.location.LocationManager;
22 | import android.os.Build;
23 | import android.os.Bundle;
24 | import android.os.Handler;
25 | import android.os.Looper;
26 | import android.support.v4.content.ContextCompat;
27 | import android.util.Log;
28 |
29 | /**
30 | * Created on 13.02.2015.
31 | */
32 | class LocationCheckStep extends CheckStep {
33 | private Context context;
34 | private Location location;
35 |
36 | public LocationCheckStep(Context context) {
37 | super("UnifiedNlp location");
38 | this.context = context;
39 | }
40 |
41 | @Override
42 | public void runStep() {
43 | LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
44 | LocationListener listener = new LocationListener() {
45 | @Override
46 | public void onLocationChanged(Location location) {
47 | Log.d("Location found", location.toString());
48 | setLocation(location);
49 | Looper.myLooper().quit();
50 | }
51 | @Override public void onStatusChanged(String provider, int status, Bundle extras) {}
52 | @Override public void onProviderEnabled(String provider) {}
53 | @Override public void onProviderDisabled(String provider) {}
54 | };
55 | Looper.prepare();
56 | new Handler().postDelayed(new Runnable() {
57 | @Override
58 | public void run() {
59 | Looper.myLooper().quit();
60 | }
61 | }, 10000);
62 |
63 | if ( Build.VERSION.SDK_INT >= 23 &&
64 | ContextCompat.checkSelfPermission( context, android.Manifest.permission.ACCESS_FINE_LOCATION ) != PackageManager.PERMISSION_GRANTED &&
65 | ContextCompat.checkSelfPermission( context, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
66 | return ;
67 | }
68 |
69 | try { locationManager.requestSingleUpdate(LocationManager.NETWORK_PROVIDER, listener, null); }
70 | catch (SecurityException e){} catch (NullPointerException e){} catch (Exception e){}
71 |
72 | Looper.loop();
73 | if(location != null) {
74 | Bundle extras = location.getExtras();
75 | if (extras != null) {
76 | if (extras.containsKey("SERVICE_BACKEND_PROVIDER")) {
77 | setState(StepState.SUCCESS);
78 | return;
79 | }
80 | }
81 | setState(StepState.FAIL);
82 | setSolution("Your location were found but it looks not like an UnifiedNlp location. Check if you have activated this module.");
83 | } else {
84 | locationManager.removeUpdates(listener);
85 | setState(StepState.FAIL);
86 | setSolution("Your location were not found. Make sure you added at least one backend.");
87 | }
88 | }
89 |
90 | public void setLocation(Location location) {
91 | this.location = location;
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/app/src/main/java/be/r3w6/xposedunifiednlp/Settings.java:
--------------------------------------------------------------------------------
1 | package be.r3w6.xposedunifiednlp;
2 |
3 | import android.app.Activity;
4 | import android.graphics.Color;
5 | import android.os.AsyncTask;
6 | import android.os.Bundle;
7 | import android.support.v4.app.ActivityCompat;
8 | import android.support.v4.content.ContextCompat;
9 | import android.content.pm.PackageManager;
10 | import android.text.Spannable;
11 | import android.text.SpannableString;
12 | import android.text.style.ForegroundColorSpan;
13 | import android.util.Log;
14 | import android.view.View;
15 | import android.widget.Button;
16 | import android.widget.TextView;
17 |
18 | import java.util.ArrayList;
19 | import java.util.List;
20 | import java.util.concurrent.Executors;
21 |
22 |
23 | public class Settings extends Activity {
24 |
25 | private List steps = new ArrayList<>();
26 | private TextView logTextView;
27 | private Activity me;
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.activity_settings);
33 | me = this;
34 |
35 | logTextView = (TextView) findViewById(R.id.textView);
36 |
37 | final Button button = (Button) findViewById(R.id.button);
38 | button.setOnClickListener(new View.OnClickListener() {
39 | public void onClick(View v) {
40 | if ( ContextCompat.checkSelfPermission( button.getContext(), android.Manifest.permission.ACCESS_COARSE_LOCATION ) != PackageManager.PERMISSION_GRANTED ) {
41 |
42 | ActivityCompat.requestPermissions(me, new String[] { android.Manifest.permission.ACCESS_COARSE_LOCATION },0 );
43 | }
44 |
45 | logTextView.setText("");
46 | startCheck();
47 | }
48 | });
49 |
50 | initCheckSteps();
51 | }
52 |
53 | private void initCheckSteps() {
54 | steps.add(new PackageCheckStep(this));
55 | steps.add(new NetworkLocationCheckStep(this));
56 | steps.add(new LocationCheckStep(this));
57 | }
58 |
59 | private void startCheck() {
60 | final Button button = (Button) findViewById(R.id.button);
61 | button.setEnabled(false);
62 | button.setText(R.string.button_check_settings_checking);
63 | AsyncTask checkWorkingTask = new AsyncTask() {
64 | @Override
65 | protected Boolean doInBackground(CheckStep... steps) {
66 |
67 | for (CheckStep step : steps) {
68 | step.setState(CheckStep.StepState.RUNNING);
69 | //publishProgress(step);
70 | step.runStep();
71 | publishProgress(step);
72 | if(step.getState() == CheckStep.StepState.FAIL) {
73 | return false;
74 | }
75 |
76 | }
77 | return true;
78 | }
79 |
80 | @Override
81 | protected void onProgressUpdate(CheckStep... values) {
82 | CheckStep step = values[0];
83 | if(step.getState() == CheckStep.StepState.SUCCESS) {
84 | Spannable toAppend = new SpannableString("Check step \"" + step.getName() + "\" finished successful.\n");
85 | toAppend.setSpan(new ForegroundColorSpan(Color.GREEN), 0, toAppend.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
86 | logTextView.append(toAppend);
87 | } else {
88 | Spannable toAppend = new SpannableString("Check step \"" + step.getName() + "\" failed.\n" + step.getSolution());
89 | toAppend.setSpan(new ForegroundColorSpan(Color.RED), 0, toAppend.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
90 | logTextView.append(toAppend);
91 | }
92 |
93 | Log.d("CheckWorkingTask", values[0].getName() + ": " + values[0].getState());
94 | }
95 |
96 | @Override
97 | protected void onPostExecute(Boolean success) {
98 | if(success)
99 | logTextView.append("Everything seems to be fine");
100 |
101 | button.setText(R.string.button_check_settings);
102 | button.setEnabled(true);
103 | }
104 | };
105 | checkWorkingTask.executeOnExecutor(Executors.newSingleThreadExecutor(), steps.toArray(new CheckStep[steps.size()]));
106 | }
107 |
108 | }
109 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------