diff --git a/play-services-core/src/main/java/org/microg/tools/selfcheck/InstalledPackagesChecks.java b/play-services-core/src/main/java/org/microg/tools/selfcheck/InstalledPackagesChecks.java deleted file mode 100755 index e34d3dd0..00000000 --- a/play-services-core/src/main/java/org/microg/tools/selfcheck/InstalledPackagesChecks.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.tools.selfcheck; - -import android.content.Context; -import android.content.pm.PackageManager; - -import com.google.android.gms.R; - -import org.microg.gms.common.Constants; -import org.microg.gms.common.PackageUtils; - -import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Negative; -import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Positive; - -public class InstalledPackagesChecks implements SelfCheckGroup { - - @Override - public String getGroupName(Context context) { - return context.getString(R.string.self_check_cat_gms_packages); - } - - @Override - public void doChecks(Context context, ResultCollector collector) { - addPackageInstalledAndSignedResult(context, collector, context.getString(R.string.self_check_pkg_gms), Constants.GMS_PACKAGE_NAME, Constants.GMS_PACKAGE_SIGNATURE_SHA1); - addPackageInstalledAndSignedResult(context, collector, context.getString(R.string.self_check_pkg_vending), "com.android.vending", Constants.GMS_PACKAGE_SIGNATURE_SHA1); - addPackageInstalledResult(context, collector, context.getString(R.string.self_check_pkg_gsf), Constants.GSF_PACKAGE_NAME); - } - - private void addPackageInstalledAndSignedResult(Context context, ResultCollector collector, String nicePackageName, String androidPackageName, String signatureHash) { - if (addPackageInstalledResult(context, collector, nicePackageName, androidPackageName)) { - addPackageSignedResult(context, collector, nicePackageName, androidPackageName, signatureHash); - } - } - - private boolean addPackageSignedResult(Context context, ResultCollector collector, String nicePackageName, String androidPackageName, String signatureHash) { - boolean hashMatches = signatureHash.equals(PackageUtils.firstSignatureDigest(context, androidPackageName)); - collector.addResult(context.getString(R.string.self_check_name_correct_sig, nicePackageName), hashMatches ? Positive : Negative, - context.getString(R.string.self_check_resolution_correct_sig, nicePackageName)); - return hashMatches; - } - - private boolean addPackageInstalledResult(Context context, ResultCollector collector, String nicePackageName, String androidPackageName) { - boolean packageExists = true; - try { - context.getPackageManager().getPackageInfo(androidPackageName, 0); - } catch (PackageManager.NameNotFoundException e) { - packageExists = false; - } - collector.addResult(context.getString(R.string.self_check_name_app_installed, nicePackageName), packageExists ? Positive : Negative, - context.getString(R.string.self_check_resolution_app_installed, nicePackageName)); - return packageExists; - } -} diff --git a/play-services-core/src/main/java/org/microg/tools/selfcheck/RomSpoofSignatureChecks.java b/play-services-core/src/main/java/org/microg/tools/selfcheck/RomSpoofSignatureChecks.java deleted file mode 100755 index beb61d98..00000000 --- a/play-services-core/src/main/java/org/microg/tools/selfcheck/RomSpoofSignatureChecks.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.tools.selfcheck; - -import android.content.Context; -import android.content.pm.PackageManager; - -import androidx.core.content.ContextCompat; -import androidx.fragment.app.Fragment; - -import com.google.android.gms.R; - -import org.microg.gms.common.Constants; -import org.microg.gms.common.PackageUtils; - -import static android.content.pm.PackageManager.PERMISSION_GRANTED; -import static org.microg.gms.common.Constants.GMS_PACKAGE_SIGNATURE_SHA1; -import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Negative; -import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Positive; -import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Unknown; - -public class RomSpoofSignatureChecks implements SelfCheckGroup { - - public static final String FAKE_SIGNATURE_PERMISSION = "android.permission.FAKE_PACKAGE_SIGNATURE"; - - @Override - public String getGroupName(Context context) { - return context.getString(R.string.self_check_cat_fake_sig); - } - - @Override - public void doChecks(Context context, ResultCollector collector) { - boolean hasPermission = addRomKnowsFakeSignaturePermission(context, collector); - if (hasPermission) { - addSystemGrantsFakeSignaturePermission(context, collector); - } - addSystemSpoofsSignature(context, collector); - } - - private boolean addRomKnowsFakeSignaturePermission(Context context, ResultCollector collector) { - boolean knowsPermission = true; - try { - context.getPackageManager().getPermissionInfo(FAKE_SIGNATURE_PERMISSION, 0); - } catch (PackageManager.NameNotFoundException e) { - knowsPermission = false; - } - collector.addResult(context.getString(R.string.self_check_name_fake_sig_perm), knowsPermission ? Positive : Unknown, - context.getString(R.string.self_check_resolution_fake_sig_perm)); - return knowsPermission; - } - - private boolean addSystemGrantsFakeSignaturePermission(Context context, ResultCollector collector) { - boolean grantsPermission = ContextCompat.checkSelfPermission(context, FAKE_SIGNATURE_PERMISSION) == PERMISSION_GRANTED; - collector.addResult(context.getString(R.string.self_check_name_perm_granted), grantsPermission ? Positive : Negative, - context.getString(R.string.self_check_resolution_perm_granted), new CheckResolver() { - @Override - public void tryResolve(Fragment fragment) { - fragment.requestPermissions(new String[]{FAKE_SIGNATURE_PERMISSION}, 0); - } - }); - return grantsPermission; - } - - private boolean addSystemSpoofsSignature(Context context, ResultCollector collector) { - boolean spoofsSignature = GMS_PACKAGE_SIGNATURE_SHA1.equals(PackageUtils.firstSignatureDigest(context, Constants.GMS_PACKAGE_NAME)); - collector.addResult(context.getString(R.string.self_check_name_system_spoofs), spoofsSignature ? Positive : Negative, - context.getString(R.string.self_check_resolution_system_spoofs)); - return spoofsSignature; - } -} diff --git a/play-services-core/src/main/java/org/microg/tools/selfcheck/SystemChecks.java b/play-services-core/src/main/java/org/microg/tools/selfcheck/SystemChecks.java deleted file mode 100755 index c091d2d0..00000000 --- a/play-services-core/src/main/java/org/microg/tools/selfcheck/SystemChecks.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.tools.selfcheck; - -import android.annotation.TargetApi; -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import android.os.PowerManager; -import android.provider.Settings; - -import androidx.fragment.app.Fragment; - -import com.google.android.gms.R; - -import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Negative; -import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Positive; - -@TargetApi(23) -public class SystemChecks implements SelfCheckGroup, SelfCheckGroup.CheckResolver { - - public static final int REQUEST_IGNORE_BATTERY_OPTIMIZATIONS = 417; - - @Override - public String getGroupName(Context context) { - return context.getString(R.string.self_check_cat_system); - } - - @Override - public void doChecks(Context context, ResultCollector collector) { - isBatterySavingDisabled(context, collector); - } - - private void isBatterySavingDisabled(final Context context, ResultCollector collector) { - PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); - collector.addResult(context.getString(R.string.self_check_name_battery_optimizations), - pm.isIgnoringBatteryOptimizations(context.getPackageName()) ? Positive : Negative, - context.getString(R.string.self_check_resolution_battery_optimizations), this); - } - - @Override - public void tryResolve(Fragment fragment) { - Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); - intent.setData(Uri.parse("package:" + fragment.getActivity().getPackageName())); - fragment.startActivityForResult(intent, REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); - } -} diff --git a/play-services-core/src/main/res/layout/ask_permission.xml b/play-services-core/src/main/res/layout/ask_permission.xml index 6ef04c35..9426a4a8 100755 --- a/play-services-core/src/main/res/layout/ask_permission.xml +++ b/play-services-core/src/main/res/layout/ask_permission.xml @@ -54,7 +54,6 @@ @@ -69,13 +68,12 @@ diff --git a/play-services-core/src/main/res/layout/device_registration_fragment.xml b/play-services-core/src/main/res/layout/device_registration_fragment.xml index 0f0648dc..9f040cbc 100755 --- a/play-services-core/src/main/res/layout/device_registration_fragment.xml +++ b/play-services-core/src/main/res/layout/device_registration_fragment.xml @@ -5,8 +5,7 @@ --> + xmlns:app="http://schemas.android.com/apk/res-auto"> diff --git a/play-services-core/src/main/res/mipmap-hdpi/ic_core_service_app.png b/play-services-core/src/main/res/mipmap-hdpi/ic_core_service_app.png deleted file mode 100755 index 47a7303a..00000000 Binary files a/play-services-core/src/main/res/mipmap-hdpi/ic_core_service_app.png and /dev/null differ diff --git a/play-services-core/src/main/res/mipmap-mdpi/ic_core_service_app.png b/play-services-core/src/main/res/mipmap-mdpi/ic_core_service_app.png deleted file mode 100644 index 7f969660..00000000 Binary files a/play-services-core/src/main/res/mipmap-mdpi/ic_core_service_app.png and /dev/null differ diff --git a/play-services-core/src/main/res/mipmap-xhdpi/ic_core_service_app.png b/play-services-core/src/main/res/mipmap-xhdpi/ic_core_service_app.png deleted file mode 100644 index dc1da208..00000000 Binary files a/play-services-core/src/main/res/mipmap-xhdpi/ic_core_service_app.png and /dev/null differ diff --git a/play-services-core/src/main/res/mipmap-xxhdpi/ic_core_service_app.png b/play-services-core/src/main/res/mipmap-xxhdpi/ic_core_service_app.png deleted file mode 100644 index 0aaee7bb..00000000 Binary files a/play-services-core/src/main/res/mipmap-xxhdpi/ic_core_service_app.png and /dev/null differ diff --git a/play-services-core/src/main/res/mipmap-xxxhdpi/ic_core_service_app.png b/play-services-core/src/main/res/mipmap-xxxhdpi/ic_core_service_app.png deleted file mode 100644 index 9bb63517..00000000 Binary files a/play-services-core/src/main/res/mipmap-xxxhdpi/ic_core_service_app.png and /dev/null differ