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

Commit eb1a15f8 authored by Romain Hunault's avatar Romain Hunault 💻
Browse files

Merge branch 'v1-oreo-sprint_istanbul' into 'v1-oreo'

[RELEASE] Sprint Istanbul

See merge request e/os/android_frameworks_base!48
parents d875377f ab1a414f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2149,6 +2149,13 @@
        android:description="@string/permdesc_getPackageSize"
        android:protectionLevel="normal" />

    <!-- @hide Allows an application to change the package signature as
	 seen by applications -->
    <permission android:name="android.permission.FAKE_PACKAGE_SIGNATURE"
        android:protectionLevel="signature|privileged"
        android:label="@string/permlab_fakePackageSignature"
        android:description="@string/permdesc_fakePackageSignature" />

    <!-- @deprecated No longer useful, see
         {@link android.content.pm.PackageManager#addPackageToPreferred}
         for details. -->
+2 −0
Original line number Diff line number Diff line
@@ -1510,6 +1510,8 @@
    <string-array name="config_locationProviderPackageNames" translatable="false">
        <!-- The standard AOSP fused location provider -->
        <item>com.android.location.fused</item>
        <!-- The (faked) microg fused location provider (a free reimplementation) -->
        <item>com.google.android.gms</item>
    </string-array>

    <!-- This string array can be overriden to enable test location providers initially. -->
+4 −0
Original line number Diff line number Diff line
@@ -714,6 +714,10 @@

    <!--  Permissions -->

    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permlab_fakePackageSignature">Spoof package signature</string>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permdesc_fakePackageSignature">Allows the app to pretend to be a different app. Malicious applications might be able to use this to access private application data. Legitimate uses include an emulator pretending to be what it emulates. Grant this permission with caution only!</string>
    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permlab_statusBar">disable or modify status bar</string>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+13 −0
Original line number Diff line number Diff line
@@ -778,6 +778,19 @@ final class DefaultPermissionGrantPolicy {
                grantRuntimePermissionsLPw(appsPackage, STORAGE_PERMISSIONS, userId);
            }
            
            // esms sync
            PackageParser.Package esmsPackage = getSystemPackageLPr("foundation.e.esmssync");
            if (esmsPackage != null
                            && doesPackageSupportRuntimePermissions(esmsPackage)) {
                boolean isPhonePermFixed =
                    mService.hasSystemFeature(PackageManager.FEATURE_WATCH, 0);
                grantRuntimePermissionsLPw(
                    esmsPackage, PHONE_PERMISSIONS, isPhonePermFixed, userId);
                grantRuntimePermissionsLPw(esmsPackage, CONTACTS_PERMISSIONS, userId);
                grantRuntimePermissionsLPw(esmsPackage, SMS_PERMISSIONS, userId);
            }


            mService.mSettings.onDefaultRuntimePermissionsGrantedLPr(userId);
        }
    }
+21 −2
Original line number Diff line number Diff line
@@ -3922,8 +3922,9 @@ public class PackageManagerService extends IPackageManager.Stub
            flags |= MATCH_ANY_USER;
        }
        PackageInfo packageInfo = PackageParser.generatePackageInfo(p, gids, flags,
                ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId);
        PackageInfo packageInfo = mayFakeSignature(p, PackageParser.generatePackageInfo(p, gids, flags,
                ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId),
                permissions);
        if (packageInfo == null) {
            return null;
@@ -3935,6 +3936,24 @@ public class PackageManagerService extends IPackageManager.Stub
        return packageInfo;
    }
    private PackageInfo mayFakeSignature(PackageParser.Package p, PackageInfo pi,
            Set<String> permissions) {
        try {
            if (permissions.contains("android.permission.FAKE_PACKAGE_SIGNATURE")
                    && p.applicationInfo.targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1
                    && p.mAppMetaData != null) {
                String sig = p.mAppMetaData.getString("fake-signature");
                if (sig != null) {
                    pi.signatures = new Signature[] {new Signature(sig)};
                }
            }
        } catch (Throwable t) {
            // We should never die because of any failures, this is system code!
            Log.w("PackageManagerService.FAKE_PACKAGE_SIGNATURE", t);
	}
        return pi;
    }
    @Override
    public void checkPackageStartable(String packageName, int userId) {
        final int callingUid = Binder.getCallingUid();