Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 508babfb authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

Update sublibs

parent b44fbf36
Loading
Loading
Loading
Loading
Compare 724063f6 to 7a96eb1c
Original line number Diff line number Diff line
Subproject commit 724063f6681c370ccb5823cfaa04a5749408bf65
Subproject commit 7a96eb1c25c880e16aa8b284dc51f9e0ce24c9f8
+6 −2
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import com.google.android.gms.R;
import org.microg.tools.selfcheck.InstalledPackagesChecks;
import org.microg.tools.selfcheck.NlpOsCompatChecks;
import org.microg.tools.selfcheck.NlpStatusChecks;
import org.microg.tools.selfcheck.PermissionChecks;
import org.microg.tools.selfcheck.PermissionCheckGroup;
import org.microg.tools.selfcheck.RomSpoofSignatureChecks;
import org.microg.tools.selfcheck.SelfCheckGroup;
import org.microg.tools.ui.AbstractAboutFragment;
@@ -38,6 +38,10 @@ import org.microg.tools.ui.AbstractSelfCheckFragment;

import java.util.List;

import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
import static android.Manifest.permission.GET_ACCOUNTS;
import static android.Manifest.permission.READ_PHONE_STATE;
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
import static android.os.Build.VERSION.SDK_INT;
import static android.os.Build.VERSION_CODES.LOLLIPOP_MR1;

@@ -93,7 +97,7 @@ public class SettingsActivity extends AppCompatActivity {
            checks.add(new RomSpoofSignatureChecks());
            checks.add(new InstalledPackagesChecks());
            if (SDK_INT > LOLLIPOP_MR1) {
                checks.add(new PermissionChecks());
                checks.add(new PermissionCheckGroup(ACCESS_COARSE_LOCATION, WRITE_EXTERNAL_STORAGE, GET_ACCOUNTS, READ_PHONE_STATE));
            }
            checks.add(new NlpOsCompatChecks());
            checks.add(new NlpStatusChecks());
+0 −74
Original line number Diff line number Diff line
/*
 * Copyright 2013-2016 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.Manifest;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.PermissionGroupInfo;
import android.content.pm.PermissionInfo;
import android.os.Build;
import android.support.v4.app.Fragment;
import android.util.Log;

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(Build.VERSION_CODES.M)
public class PermissionChecks implements SelfCheckGroup {
    private static final String TAG = "SelfCheckPerms";

    @Override
    public String getGroupName(Context context) {
        return context.getString(R.string.self_check_cat_permissions);
    }

    @Override
    public void doChecks(Context context, ResultCollector collector) {
        doPermissionCheck(context, collector, Manifest.permission.ACCESS_COARSE_LOCATION);
        doPermissionCheck(context, collector, Manifest.permission.ACCESS_FINE_LOCATION);
        doPermissionCheck(context, collector, Manifest.permission.WRITE_EXTERNAL_STORAGE);
        doPermissionCheck(context, collector, Manifest.permission.GET_ACCOUNTS);
        doPermissionCheck(context, collector, Manifest.permission.READ_PHONE_STATE);
        doPermissionCheck(context, collector, com.google.android.gms.Manifest.permission.SEND);
    }

    private void doPermissionCheck(Context context, ResultCollector collector, final String permission) {
        PackageManager pm = context.getPackageManager();
        try {
            PermissionInfo info = pm.getPermissionInfo(permission, 0);
            PermissionGroupInfo groupInfo = info.group != null ? pm.getPermissionGroupInfo(info.group, 0) : null;
            CharSequence permLabel = info.loadLabel(pm);
            CharSequence groupLabel = groupInfo != null ? groupInfo.loadLabel(pm) : permLabel;
            collector.addResult(context.getString(R.string.self_check_name_permission, permLabel),
                    context.checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED ? Positive : Negative,
                    context.getString(R.string.self_check_resolution_permission, groupLabel),
                    new SelfCheckGroup.CheckResolver() {

                        @Override
                        public void tryResolve(Fragment fragment) {
                            fragment.requestPermissions(new String[]{permission}, 0);
                        }
                    });
        } catch (PackageManager.NameNotFoundException e) {
            Log.w(TAG, e);
        }
    }
}
+0 −8
Original line number Diff line number Diff line
@@ -89,14 +89,6 @@
    <string name="self_check_resolution_correct_sig">Или инсталирана %1$s није одговарајућа или заваравање потписа није укључено за њу. Погледајте документацију да сазнате које су апликације и РОМови одговарајући.</string>
    <string name="perm_extended_access_label">Проширени приступ Гугловим услугама</string>

    <string name="self_check_cat_permissions">Дозволе одобрене</string>
    <string name="self_check_name_permission">Дозволе за %1$s:</string>
    <string name="self_check_resolution_permission">Тапните овде да одобрите дозволе за %1$s. Не одобравање дозвола може да резултира чудним понашањем апликација.</string>
    <string name="self_check_perm_location">локација</string>
    <string name="self_check_perm_storage">складиште</string>
    <string name="self_check_perm_contacts">контакти</string>
    <string name="self_check_perm_phone">телефон</string>

    <string name="lacking_permission_toast">Језгро микроГ услуга: Немам дозволу за %1$s</string>

    <string name="place_picker_select_title">Изаберите ову локацију</string>
+0 −8
Original line number Diff line number Diff line
@@ -95,14 +95,6 @@ This can take a couple of minutes."</string>
    <string name="self_check_resolution_correct_sig">Either the installed %1$s is not compatible or signature spoofing is not active for it. Please check the documentation on which applications and ROMs are compatible.</string>
    <string name="perm_extended_access_label">Extended access to Google services</string>

    <string name="self_check_cat_permissions">Permissions granted</string>
    <string name="self_check_name_permission">Permission to %1$s:</string>
    <string name="self_check_resolution_permission">Touch here to grant permission to %1$s. Not granting the permission can result in misbehaving applications.</string>
    <string name="self_check_perm_location">location</string>
    <string name="self_check_perm_storage">storage</string>
    <string name="self_check_perm_contacts">contacts</string>
    <string name="self_check_perm_phone">phone</string>

    <string name="lacking_permission_toast">microG Services Core: Lacking permission %1$s</string>

    <string name="place_picker_select_title">Select this location</string>