<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ 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.
  -->
<manifest package="com.google.android.gms"
          xmlns:android="http://schemas.android.com/apk/res/android">

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="23"/>

    <permission
        android:name="com.google.android.c2dm.permission.RECEIVE"
        android:label="@string/perm_c2dm_receive_label"
        android:permissionGroup="android.permission-group.NETWORK"
        android:protectionLevel="normal"/>
    <permission
        android:name="com.google.android.c2dm.permission.SEND"
        android:label="@string/perm_c2dm_send_label"
        android:protectionLevel="signature"/>

    <permission-tree
        android:name="com.google.android.googleapps.permission.GOOGLE_AUTH"
        android:icon="@drawable/proprietary_auth_ic_scope_icon_default"/>

    <permission
        android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.local"
        android:description="@string/permission_service_local_description"
        android:label="@string/permission_service_local_label"
        android:protectionLevel="dangerous"/>
    <permission
        android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.mail"
        android:description="@string/permission_service_mail_description"
        android:label="@string/permission_service_mail_label"
        android:protectionLevel="dangerous"/>
    <permission
        android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.writely"
        android:description="@string/permission_service_writely_description"
        android:label="@string/permission_service_writely_label"
        android:protectionLevel="dangerous"/>
    <permission
        android:name="org.microg.gms.STATUS_BROADCAST"
        android:label="@string/perm_status_broadcast_label"
        android:protectionLevel="normal"/>
    <permission
        android:name="org.microg.gms.EXTENDED_ACCESS"
        android:label="@string/perm_extended_access_label"
        android:protectionLevel="dangerous"/>

    <uses-permission android:name="android.permission.FAKE_PACKAGE_SIGNATURE"/>

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>

    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
    <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
    <uses-permission android:name="android.permission.USE_CREDENTIALS"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
    <uses-permission android:name="com.google.android.c2dm.permission.SEND"/>
    <uses-permission android:name="org.microg.gms.STATUS_BROADCAST"/>
    <uses-permission android:name="org.microg.gms.EXTENDED_ACCESS"/>

    <application
        android:allowBackup="false"
        android:icon="@mipmap/ic_core_service_app"
        android:label="@string/gms_app_name">
        <meta-data
            android:name="fake-signature"
            android:value="@string/fake_signature"/>

        <!-- Location -->

        <service android:name="org.microg.gms.location.GoogleLocationManagerService">
            <intent-filter>
                <action android:name="com.google.android.location.internal.GoogleLocationManagerService.START"/>
            </intent-filter>
        </service>
        <service android:name="org.microg.gms.location.ReportingAndroidService">
            <intent-filter>
                <action android:name="com.google.android.location.reporting.service.START"/>
                <action android:name="com.google.android.gms.location.reporting.service.START"/>

                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </service>

        <activity
            android:name="org.microg.gms.ui.PlacePickerActivity"
            android:exported="true"
            android:label="@string/pick_place_title"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar">
            <intent-filter>
                <action android:name="com.google.android.gms.location.places.ui.PICK_PLACE"/>

                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>

        <service android:name="org.microg.gms.places.GeoDataService">
            <intent-filter>
                <action android:name="com.google.android.gms.location.places.GeoDataApi"/>
                <action android:name="com.google.android.gms.location.places.PlacesApi"/>
            </intent-filter>
        </service>

        <service android:name="org.microg.gms.places.PlaceDetectionService">
            <intent-filter>
                <action android:name="com.google.android.gms.location.places.PlaceDetectionApi"/>
            </intent-filter>
        </service>

        <!-- Services Framework -->

        <provider
            android:name="org.microg.gms.gservices.GServicesProvider"
            android:authorities="com.google.android.gsf.gservices"
            android:exported="true"/>
        <provider
            android:name="org.microg.gms.settings.GoogleSettingsProvider"
            android:authorities="com.google.settings"
            android:exported="true"/>
        <provider
            android:name="org.microg.gms.feeds.SubscribedFeedsProvider"
            android:authorities="subscribedfeeds"
            android:exported="true"
            android:multiprocess="false"
            android:readPermission="android.permission.SUBSCRIBED_FEEDS_READ"
            android:writePermission="android.permission.SUBSCRIBED_FEEDS_WRITE"/>

        <!-- Device Checkin -->

        <service android:name="org.microg.gms.checkin.CheckinService">
            <intent-filter>
                <action android:name="com.google.android.gms.checkin.BIND_TO_SERVICE"/>
            </intent-filter>
        </service>

        <receiver android:name="org.microg.gms.checkin.TriggerReceiver">
            <intent-filter>
                <action android:name="android.server.checkin.CHECKIN"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
            </intent-filter>
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE"/>

                <category android:name="android.server.checkin.CHECKIN"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.provider.Telephony.SECRET_CODE"/>

                <data
                    android:host="2432546"
                    android:scheme="android_secret_code"/>
            </intent-filter>
        </receiver>

        <!-- Cloud Messaging -->
        <service
            android:name="org.microg.gms.gcm.PushRegisterService"
            android:permission="com.google.android.c2dm.permission.RECEIVE">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.REGISTER"/>

                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.UNREGISTER"/>

                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </service>
        <service
            android:name="org.microg.gms.gcm.McsService"
            android:exported="true"/>

        <receiver android:name="org.microg.gms.gcm.TriggerReceiver">
            <intent-filter>
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
                <action android:name="org.microg.gms.gcm.RECONNECT"/>
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
                <action android:name="android.intent.action.PACKAGE_RESTARTED"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.provider.Telephony.SECRET_CODE"/>

                <data
                    android:host="42678278"
                    android:scheme="android_secret_code"/>
            </intent-filter>
        </receiver>

        <!-- Map -->
        <provider
            android:name="org.microg.gms.maps.data.SharedTileProvider"
            android:authorities="org.microg.gms.map.tile"
            android:enabled="true"
            android:exported="true"/>

        <!-- DroidGuard -->

        <service android:name="org.microg.gms.droidguard.DroidGuardService">
            <intent-filter>
                <action android:name="com.google.android.gms.droidguard.service.START"/>

                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </service>

        <!-- Car -->

        <service android:name="org.microg.gms.car.CarService">
            <intent-filter>
                <action android:name="com.google.android.gms.car.service.START"/>

                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </service>

        <!-- People -->

        <service android:name="org.microg.gms.people.PeopleService">
            <intent-filter>
                <action android:name="com.google.android.gms.people.service.START"/>

                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </service>

        <!-- Wearable -->

        <service android:name="org.microg.gms.wearable.WearableService">
            <intent-filter>
                <action android:name="com.google.android.gms.wearable.BIND"/>
            </intent-filter>
        </service>

        <!-- Auth -->

        <service android:name="org.microg.gms.auth.loginservice.GoogleLoginService">
            <intent-filter>
                <action android:name="android.accounts.AccountAuthenticator"/>
            </intent-filter>
            <intent-filter>
                <action android:name="com.google.android.gsf.action.GET_GLS"/>
            </intent-filter>

            <meta-data
                android:name="android.accounts.AccountAuthenticator"
                android:resource="@xml/authenticator"/>
            <meta-data
                android:name="android.accounts.AccountAuthenticator.customTokens"
                android:value="1"/>
        </service>

        <activity
            android:name="org.microg.tools.AccountPickerActivity"
            android:excludeFromRecents="true"
            android:exported="true">
            <intent-filter>
                <action android:name="com.google.android.gms.common.account.CHOOSE_ACCOUNT"/>

                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>

        <activity
            android:name="org.microg.gms.auth.login.LoginActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:exported="true"
            android:theme="@style/LoginBlueTheme">
            <intent-filter>
                <action android:name="com.google.android.gms.auth.login.LOGIN"/>

                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>

        <activity
            android:name="org.microg.gms.auth.AskPermissionActivity"
            android:excludeFromRecents="true"
            android:exported="true"
            android:theme="@style/Theme.AppCompat.Light.Dialog"/>

        <service
            android:name=".auth.GetToken"
            android:exported="true"/>

        <activity
            android:name=".auth.TokenActivity"
            android:exported="true"/>

        <provider
            android:name="org.microg.gms.auth.AccountContentProvider"
            android:authorities="com.google.android.gms.auth.accounts"
            android:exported="true"/>

        <!-- Games -->

        <service android:name="org.microg.gms.games.GamesStubService">
            <intent-filter>
                <action android:name="com.google.android.gms.games.service.START"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </service>

        <activity
            android:name="org.microg.gms.games.UpgradeActivity"
            android:theme="@style/Theme.AppCompat.Light.Dialog">
            <intent-filter>
                <action android:name="com.google.android.gms.games.PLAY_GAMES_UPGRADE"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>

        <!-- microG custom UI -->

        <activity
            android:name="org.microg.gms.ui.SettingsActivity"
            android:icon="@mipmap/ic_microg_settings"
            android:label="@string/gms_settings_name"
            android:theme="@style/SettingsTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <intent-filter>
                <action android:name="com.google.android.gms.location.settings.LOCATION_HISTORY"/>
                <action android:name="com.google.android.location.settings.LOCATION_REPORTING_SETTINGS"/>
                <action android:name="com.google.android.gms.location.settings.LOCATION_REPORTING_SETTINGS"/>

                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>

        <!-- Other -->

        <service android:name="org.microg.gms.mdm.NetworkQualityService">
            <intent-filter>
                <action android:name="com.google.android.gms.mdm.services.START"/>

                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </service>
        <service android:name="org.microg.gms.icing.LightweightIndexService">
            <intent-filter>
                <action android:name="com.google.android.gms.icing.LIGHTWEIGHT_INDEX_SERVICE"/>
            </intent-filter>
        </service>
        <service android:name="org.microg.gms.icing.IndexService">
            <intent-filter>
                <action android:name="com.google.android.gms.icing.INDEX_SERVICE"/>
            </intent-filter>
        </service>
        <service
            android:name=".analytics.service.AnalyticsService"
            android:exported="true">
            <intent-filter>
                <action android:name="com.google.android.gms.analytics.service.START"/>
            </intent-filter>
        </service>
        <service android:name="org.microg.gms.playlog.PlayLogService">
            <intent-filter>
                <action android:name="com.google.android.gms.playlog.service.START"/>
            </intent-filter>
        </service>
        <service
            android:name=".gcm.http.GoogleHttpService"
            android:exported="true"/>

        <service android:name="org.microg.gms.ads.GService">
            <intent-filter>
                <action android:name="com.google.android.gms.ads.gservice.START"/>
            </intent-filter>
        </service>
        <service android:name="org.microg.gms.feedback.FeedbackService">
            <intent-filter>
                <action android:name="com.google.android.gms.feedback.internal.IFeedbackService"/>
            </intent-filter>
        </service>
        <service android:name="org.microg.gms.ads.AdvertisingIdService">
            <intent-filter>
                <action android:name="com.google.android.gms.ads.identifier.service.START"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </service>
        <service android:name="org.microg.gms.clearcut.ClearcutLoggerService">
            <intent-filter>
                <action android:name="com.google.android.gms.clearcut.service.START"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </service>
        <service android:name="org.microg.gms.drive.api.DriveApiService">
            <intent-filter>
                <action android:name="com.google.android.gms.drive.ApiService.START"/>
                <action android:name="com.google.android.gms.drive.ApiService.STOP"/>
                <action android:name="com.google.android.gms.drive.ApiService.RESET_AFTER_BOOT"/>

                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </service>
        <service android:name="org.microg.gms.auth.SignInService">
            <intent-filter>
                <action android:name="com.google.android.gms.signin.service.START"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </service>

        <service android:name="org.microg.gms.DummyService">
            <intent-filter>
                <action android:name="com.google.android.gms.plus.service.START"/>
                <action android:name="com.google.android.gms.plus.service.internal.START"/>
                <action android:name="com.google.android.gms.panorama.service.START"/>
                <action android:name="com.google.android.gms.wallet.service.BIND"/>
                <action android:name="com.google.android.gms.appstate.service.START"/>
                <action android:name="com.google.android.gms.ads.service.START"/>
                <action android:name="com.google.android.gms.accounts.ACCOUNT_SERVICE"/>
                <action android:name="com.google.android.gms.cast.service.BIND_CAST_DEVICE_CONTROLLER_SERVICE"/>
                <action android:name="com.google.android.gms.identity.service.BIND"/>
                <action android:name="com.google.android.gms.wearable.BIND"/>
                <action android:name="com.google.android.gms.auth.service.START"/>
                <action android:name="com.google.android.gms.fitness.GoogleFitnessService.START"/>
                <action android:name="com.google.android.gms.reminders.service.START"/>
                <action android:name="com.google.android.gms.deviceconnection.service.START"/>
                <action android:name="com.google.android.gms.droidguard.service.START"/>
                <action android:name="com.google.android.gms.lockbox.service.START"/>
                <action android:name="com.google.android.gms.cast_mirroring.service.START"/>
                <action android:name="com.google.android.gms.photos.autobackup.service.START"/>
                <action android:name="com.google.android.gms.udc.service.START"/>
                <action android:name="com.google.android.gms.mdm.services.DeviceManagerApiService.START"/>
                <action android:name="com.google.android.gms.pseudonymous.service.START"/>
                <action android:name="com.google.android.gms.common.service.START"/>
                <action android:name="com.google.android.gms.usagereporting.service.START"/>
                <action android:name="com.google.android.gms.kids.service.START"/>
                <action android:name="com.google.android.gms.common.download.START"/>
                <action android:name="com.google.android.gms.safetynet.service.START"/>
                <action android:name="com.google.android.contextmanager.service.ContextManagerService.START"/>
                <action android:name="com.google.android.gms.audiomodem.service.AudioModemService.START"/>
                <action android:name="com.google.android.gms.nearby.sharing.service.NearbySharingService.START"/>
                <action android:name="com.google.android.gms.herrevad.services.LightweightNetworkQualityAndroidService.START"/>
                <action android:name="com.google.android.gms.phenotype.service.START"/>
                <action android:name="com.google.android.gms.auth.api.credentials.service.START"/>
            </intent-filter>
        </service>
    </application>

</manifest>
