Merge pull request #9654 from JosJuice/android-12-early

Android: Early changes to adapt for Android 12
This commit is contained in:
Léo Lam 2021-04-19 21:25:18 +02:00 committed by GitHub
commit ec5fbeb0d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 15 deletions

View File

@ -1,5 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.dolphinemu.dolphinemu"> xmlns:tools="http://schemas.android.com/tools"
package="org.dolphinemu.dolphinemu">
<uses-feature <uses-feature
android:name="android.hardware.touchscreen" android:name="android.hardware.touchscreen"
@ -37,13 +38,16 @@
android:allowBackup="false" android:allowBackup="false"
android:supportsRtl="true" android:supportsRtl="true"
android:isGame="true" android:isGame="true"
android:banner="@drawable/banner_tv"> android:banner="@drawable/banner_tv"
android:debuggable="true"
tools:ignore="HardcodedDebugMode">
<meta-data <meta-data
android:name="android.max_aspect" android:name="android.max_aspect"
android:value="2.1"/> android:value="2.1"/>
<activity <activity
android:name=".ui.main.MainActivity" android:name=".ui.main.MainActivity"
android:exported="true"
android:theme="@style/DolphinBase"> android:theme="@style/DolphinBase">
<!-- This intentfilter marks this Activity as the one that gets launched from Home screen. --> <!-- This intentfilter marks this Activity as the one that gets launched from Home screen. -->
@ -56,6 +60,7 @@
<activity <activity
android:name=".ui.main.TvMainActivity" android:name=".ui.main.TvMainActivity"
android:exported="true"
android:theme="@style/DolphinTvBase"> android:theme="@style/DolphinTvBase">
<!-- This intentfilter marks this Activity as the one that gets launched from Home screen. --> <!-- This intentfilter marks this Activity as the one that gets launched from Home screen. -->
@ -68,26 +73,33 @@
<activity <activity
android:name=".features.settings.ui.SettingsActivity" android:name=".features.settings.ui.SettingsActivity"
android:exported="false"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:theme="@style/DolphinSettingsBase" android:theme="@style/DolphinSettingsBase"
android:label="@string/preferences_settings"/> android:label="@string/preferences_settings"/>
<activity <activity
android:name=".activities.EmulationActivity" android:name=".activities.EmulationActivity"
android:exported="false"
android:theme="@style/DolphinEmulationBase" android:theme="@style/DolphinEmulationBase"
android:preferMinimalPostProcessing="true"/> android:preferMinimalPostProcessing="true"/>
<activity <activity
android:name=".activities.CustomFilePickerActivity" android:name=".activities.CustomFilePickerActivity"
android:exported="false"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/FilePickerTheme"> android:theme="@style/FilePickerTheme">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.GET_CONTENT"/> <action android:name="android.intent.action.GET_CONTENT"/>
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".activities.AppLinkActivity"> <activity
android:name=".activities.AppLinkActivity"
android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW"/> <action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
@ -99,14 +111,22 @@
<activity <activity
android:name=".activities.ConvertActivity" android:name=".activities.ConvertActivity"
android:exported="false"
android:theme="@style/DolphinBase" /> android:theme="@style/DolphinBase" />
<service android:name=".utils.DirectoryInitialization"/> <service
<service android:name=".services.GameFileCacheService"/> android:name=".utils.DirectoryInitialization"
android:exported="false"/>
<service
android:name=".services.GameFileCacheService"
android:exported="false"/>
<service <service
android:name=".services.SyncChannelJobService" android:name=".services.SyncChannelJobService"
android:exported="false" android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE"/> android:permission="android.permission.BIND_JOB_SERVICE"/>
<service <service
android:name=".services.SyncProgramsJobService" android:name=".services.SyncProgramsJobService"
android:exported="false" android:exported="false"

View File

@ -11,6 +11,7 @@ import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbEndpoint; import android.hardware.usb.UsbEndpoint;
import android.hardware.usb.UsbInterface; import android.hardware.usb.UsbInterface;
import android.hardware.usb.UsbManager; import android.hardware.usb.UsbManager;
import android.os.Build;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.Keep; import androidx.annotation.Keep;
@ -46,11 +47,13 @@ public class Java_GCAdapter
{ {
if (!manager.hasPermission(dev)) if (!manager.hasPermission(dev))
{ {
Intent intent = new Intent(); Intent intent = new Intent(context, USBPermService.class);
PendingIntent pend_intent;
intent.setClass(context, USBPermService.class); int flags = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ?
pend_intent = PendingIntent.getService(context, 0, intent, 0); PendingIntent.FLAG_IMMUTABLE : 0;
manager.requestPermission(dev, pend_intent); PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, flags);
manager.requestPermission(dev, pendingIntent);
} }
} }
} }

View File

@ -9,6 +9,7 @@ import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbEndpoint; import android.hardware.usb.UsbEndpoint;
import android.hardware.usb.UsbInterface; import android.hardware.usb.UsbInterface;
import android.hardware.usb.UsbManager; import android.hardware.usb.UsbManager;
import android.os.Build;
import androidx.annotation.Keep; import androidx.annotation.Keep;
@ -50,11 +51,14 @@ public class Java_WiimoteAdapter
if (!manager.hasPermission(dev)) if (!manager.hasPermission(dev))
{ {
Log.warning("Requesting permission for Wii Remote adapter"); Log.warning("Requesting permission for Wii Remote adapter");
Intent intent = new Intent();
PendingIntent pend_intent; Intent intent = new Intent(context, USBPermService.class);
intent.setClass(context, USBPermService.class);
pend_intent = PendingIntent.getService(context, 0, intent, 0); int flags = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ?
manager.requestPermission(dev, pend_intent); PendingIntent.FLAG_IMMUTABLE : 0;
PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, flags);
manager.requestPermission(dev, pendingIntent);
} }
} }
} }