Android Question API 30 - MANAGE_EXTERNAL_STORAGE Problem

DavideTr94

Member
Hi everyone,
with the obligation from November 2021 to update the apps on the Play Store with the SDK target 30, I followed this guide ( https://www.b4x.com/android/forum/t...cess-internal-external-storage-sdk-30.130411/ ) to make the apps compatible with the new versions of Android as regards access to the memory.

Everything works fine but one of these apps was rejected by the Play Store because according to them access to the memory was not necessary and they recommend using the Media Store API.

We have corrected the app by readjusting the various functions and we have completely eliminated all traces inherent to the "MANAGE_EXTERNAL_STORAGE" permission, nevertheless every version we publish is rejected because they insinuate that we must remove this permission, which has actually already been removed!

We no longer know where to turn, while removing all traces, the update we send does not pass, always for the same reason: does someone kindly know how we can solve it?

I attach the Manifest of the application, maybe we are missing something, thank you very much!

Manifest:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="25" android:targetSdkVersion="30"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:largeHeap,"true")
SetApplicationAttribute(android:requestLegacyExternalStorage, true)
SetServiceAttribute(StepCounterServices, android:foregroundServiceType, "location")
'End of default text.
'===== Supporto Notch =====
SetApplicationAttribute(android:theme, "@style/CustomTheme")

CreateResource(values, theme.xml,
<resources>
    <style name="CustomTheme" parent="@android:style/Theme.Holo.Light">
        <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
    </style>
</resources>)

'===== Imposta Launcher =====
AddActivityText(main, <intent-filter >
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.HOME" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>)
'===== Permessi =====
AddPermission(android.permission.USE_BIOMETRIC)
AddPermission("android.permission.ACCESS_NETWORK_STATE")
AddPermission("android.permission.ACCESS_LOCATION")
AddPermission("android.permission.ACCESS_GPS")
AddPermission("android.permission.ACCESS_ASSISTED_GPS")
AddPermission("android.permission.ACCESS_CELL_ID")
AddPermission("android.permission.ACCESS_COARSE_LOCATION")
AddPermission("android.permission.ACCESS_CHECKIN_PROPERTIES")
AddPermission("android.permission.ACCESS_LOCATION_EXTRA_COMMANDS")
AddPermission("android.permission.ACCESS_FINE_LOCATION")
AddPermission("android.permission.ACCESS_WIFI_STATE")
AddPermission("android.permission.BLUETOOTH_ADMIN")
AddPermission("android.permission.BLUETOOTH")
AddPermission("android.permission.BOOT_COMPLETED")
AddPermission("android.permission.CALL_PHONE")
AddPermission("android.permission.CALL_PRIVILEGED")
AddPermission("android.permission.CAMERA")
AddPermission("android.permission.CHANGE_WIFI_STATE")
AddPermission("android.permission.FLASHLIGHT")
AddPermission("android.permission_group.HARDWARE_CONTROLS")
AddPermission("android.permission.HARDWARE_TEST")
AddPermission("android.permission.INTERNET")
AddPermission("android.permission.MODIFY_PHONE_STATE")
AddPermission("android.permission.READ_PHONE_STATE")
AddPermission("android.permission.RECEIVE_BOOT_COMPLETED")
AddPermission("android.permission.SET_WALLPAPER")
AddPermission("android.permission.UPDATE_DEVICE_STATS")
AddPermission("android.permission.WAKE_LOCK")
AddPermission("android.permission.WRITE_SETTINGS")
AddPermission("android.permission.WRITE_SECURE_SETTINGS")
AddPermission("android.permission.REBOOT")
AddPermission("android.permission.NFC")
AddPermission("android.permission.CLEAR_APP_CACHE")
AddPermission("android.permission.READ_CONTACTS")
AddPermission("android.permission.RUN_INSTRUMENTATION")
AddPermission("android.permission.VIBRATE")
AddPermission("android.permission.CHANGE_NETWORK_STATE")
AddPermission("android.permission.ACCESS_COARSE_UPDATES")
AddPermission("android.permission.SET_WALLPAPER_HINTS")
AddPermission("android.permission.GET_ACCOUNTS")
AddPermission("android.permission.REQUEST_INSTALL_PACKAGES")
AddPermission("android.permission.BIND_DEVICE_ADMIN")
AddPermission("android.permission.EXPAND_STATUS_BAR")
AddPermission("android.permission.INTERACT_ACROSS_USERS_FULL")
AddPermission("android.permission.RECORD_AUDIO")
AddPermission("android.permission.REQUEST_DELETE_PACKAGES")
AddPermission(android.permission.GET_TASKS)
AddPermission(android.permission.DISABLE_KEYGUARD)
AddPermission(android.permission.ACCESS_BACKGROUND_LOCATION)
AddPermission(android.permission.ACCESS_CHECKIN_PROPERTIES)
AddPermission(android.permission.ACTIVITY_RECOGNITION)
AddPermission(android.permission.QUERY_ALL_PACKAGES)

AddManifestText(<uses-feature android:name="android.hardware.location.gps"/>)

'===== Autorizzazioni Rimosse =====
RemovePermission("android.permission.RECEIVE_SMS")
RemovePermission("android.permission.READ_SMS")
RemovePermission("android.permission.SEND_SMS")
RemovePermission("android.permission.WRITE_SMS")
RemovePermission("android.permission.RECEIVE_MMS")
RemovePermission("android.permission.READ_CALL_LOG")
RemovePermission("android.permission.PROCESS_OUTGOING_CALLS")
RemovePermission("android.permission.RECEIVE_WAP_PUSH")
RemovePermission("android.permission.MANAGE_EXTERNAL_STORAGE")

'===== Informazioni Attività =====
SetActivityAttribute(Main, android:screenOrientation, "portrait")
SetActivityAttribute(Welcome, android:screenOrientation, "portrait")
SetActivityAttribute(GUIDownloader, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig1, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig2, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig3, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig4, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig5, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig6, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig7, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig8, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig9, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig10, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig11, android:screenOrientation, "portrait")
SetActivityAttribute(InitialLanguageSelector, android:screenOrientation, "portrait")
SetActivityAttribute(Home, android:screenOrientation, "portrait")
SetActivityAttribute(LockScreen, android:screenOrientation, "portrait")
SetActivityAttribute(PhoneDialer, android:screenOrientation, "portrait")
SetActivityAttribute(FinishConfig, android:screenOrientation, "portrait")
SetActivityAttribute(UpdateInfoForm, android:screenOrientation, "portrait")
SetActivityAttribute(RecoveryMode, android:screenOrientation, "portrait")
SetActivityAttribute(BootFailActivity, android:screenOrientation, "portrait")
SetActivityAttribute(OperatorAlertActivity, android:screenOrientation, "portrait")
SetActivityAttribute(PhoneCallerID, android:screenOrientation, "portrait")
SetActivityAttribute(RestoreCodeActivity, android:screenOrientation, "portrait")
SetActivityAttribute(MemoryAlertActivity, android:screenOrientation, "portrait")
SetActivityAttribute(BugReportActivity, android:screenOrientation, "portrait")
'SetActivityAttribute(InAppControlCenter, android:theme, "@android:style/Theme.Translucent")
SetActivityAttribute(AppManagerInstallerActivity, android:screenOrientation, "portrait")
SetActivityAttribute(AdaptiveBoxActivity, android:screenOrientation, "portrait")
SetActivityAttribute(EmergencyDialerActivity, android:screenOrientation, "portrait")
SetActivityAttribute(RebootActivity, android:screenOrientation, "portrait")
SetActivityAttribute(AuthorizationActivity, android:screenOrientation, "portrait")
SetActivityAttribute(MaliciousAppsActivity, android:screenOrientation, "portrait")
SetActivityAttribute(TutorialActivity, android:screenOrientation, "portrait")
SetActivityAttribute(UpdateDownloaderActivity, android:screenOrientation, "portrait")
SetActivityAttribute(LangDownloaderActivity, android:screenOrientation, "portrait")
SetActivityAttribute(ThermalAlertActivity, android:screenOrientation, "portrait")
SetActivityAttribute(SubscriptionAlertActivity, android:screenOrientation, "portrait")
SetActivityAttribute(SubscriptionBuyActivity, android:screenOrientation, "portrait")
SetActivityAttribute(UserContractsActivity, android:screenOrientation, "portrait")
SetActivityAttribute(InitialSubscriptionSelectorActivity, android:screenOrientation, "portrait")
SetActivityAttribute(SubscriptionManagerActivity, android:screenOrientation, "portrait")
SetActivityAttribute(SubscriptionLostActivity, android:screenOrientation, "portrait")
SetActivityAttribute(MinimumRequirementsActivity, android:screenOrientation, "portrait")
SetActivityAttribute(SubscriptionDoubleAlertActivity, android:screenOrientation, "portrait")
SetActivityAttribute(AccountCheckerActivity, android:screenOrientation, "portrait")
SetActivityAttribute(SettingsCloudBackupActivity, android:screenOrientation, "portrait")
SetActivityAttribute(SetDefaultLauncherActivity, android:screenOrientation, "portrait")
SetActivityAttribute(DownloadManagerActivity, android:screenOrientation, "portrait")
SetActivityAttribute(GraphicDownloadActivity, android:screenOrientation, "portrait")
SetActivityAttribute(CloudCountdownActivity, android:screenOrientation, "portrait")
SetActivityAttribute(AlwaysOnDisplay_InitialConfig, android:screenOrientation, "portrait")
SetActivityAttribute(ChangeTextSizeActivity, android:screenOrientation, "portrait")
SetActivityAttribute(UpdateAlertActivity, android:screenOrientation, "portrait")
SetActivityAttribute(ConfigTypeSelectorActivity, android:screenOrientation, "portrait")
SetActivityAttribute(AppsManagerUninstallActivity, android:screenOrientation, "portrait")
SetActivityAttribute(RecoveryModeActivity, android:screenOrientation, "portrait")

'===== Singole Istanze =====
'SetActivityAttribute(Home, android:launchMode, "singleInstance")
'SetActivityAttribute(LockScreen, android:launchMode, "singleInstance")

SetActivityAttribute(Home, android:excludeFromRecents, "true")
SetActivityAttribute(LockScreen, android:excludeFromRecents, "true")
'===== Processo Notifiche =====
AddApplicationText(
<service android:name="anywheresoftware.b4a.objects.NotificationListenerWrapper"
   android:label="Professional UI"
  android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
  <intent-filter>
  <action android:name="android.service.notification.NotificationListenerService" />
  </intent-filter>
</service>)
'===== Amministratore =====
AddApplicationText(<receiver android:name="anywheresoftware.b4a.objects.AdminManager$AdminReceiver"
  android:permission="android.permission.BIND_DEVICE_ADMIN">
  <meta-data android:name="android.app.device_admin"
  android:resource="@xml/device_admin" />
  <intent-filter>
  <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
  </intent-filter>
</receiver>)

CreateResource(xml, device_admin.xml,
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
  <uses-policies>
  <limit-password />
  <reset-password />
  <force-lock />
  </uses-policies>
</device-admin>
)
'===== Permessi di Installazioni Esterne =====
AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)
CreateResource(xml, provider_paths,
   <external-files-path name="name" path="" />
)
'===== Gestione Abbonamenti =====
CreateResourceFromFile(Macro, GooglePlayBilling.GooglePlayBilling)
AddPermission("com.android.vending.BILLING")

'===== Gestione Tema di Sistema =====
SetApplicationAttribute(android:theme, "@style/Custom")
CreateResource(values-v20, theme.xml,
<resources>
  <style name="Custom" parent="@android:style/Theme.Material.Light.NoActionBar">
     <item name="android:windowTranslucentNavigation">false</item>
     <item name="android:windowTranslucentStatus">true</item>
     <item name="android:forceDarkAllowed">false</item>
  </style>
</resources>
)
'===== Gestione Dialer =====
'AddReceiverText(LockScreenCheck, <intent-filter>
'    <action android:name="android.intent.action.NEW_OUTGOING_CALL" />
'    <category android:name="android.intent.category.DEFAULT" />
'</intent-filter>)
 
Solution
Thanks, I solved that problem by inserting a similar thing for each Activity.

Solution:
Dim rp As RuntimePermissions
rp.GetSafeDirDefaultExternal("")

Now a similar problem has arisen with loading of User Wallpaper, in many parts of software the user default wallpaper is loaded in a PictureBox, the app crashes badly with this log:

Wallpaper Problem:
** Activity (bugreportactivity) Create, isFirst = true **
/storage/emulated/0/Android/data/com.blacksystem.professionallauncher/files/
(RemoteException) android.os.RemoteException: Remote stack trace:
    at android.app.ContextImpl.enforce(ContextImpl.java:1924)
    at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1952)
    at...

Erel

B4X founder
Staff member
Licensed User
Longtime User
with the obligation from November 2021 to update the apps on the Play Store with the SDK target 30, I followed this guide ( https://www.b4x.com/android/forum/t...cess-internal-external-storage-sdk-30.130411/ ) to make the apps compatible with the new versions of Android as regards access to the memory.
Why?

1640845556004.png


You need to follow this: https://www.b4x.com/android/forum/t...list-of-other-related-methods.129897/#content

We no longer know where to turn, while removing all traces, the update we send does not pass, always for the same reason: does someone kindly know how we can solve it?
Can you upload the generated Objects\AndroidManifest.xml file?
 
Upvote 0

DavideTr94

Member
Here is the XML file generated: I do not understand why by removing all traces of "MANAGE_EXTERNAL_STORAGE", they keep saying that the update does not pass for the same reason.
The only request that is made to the user is the basic one through RuntimePermissions.

Request process:
Sub AuthorizationProcess_Timer_Tick
    'Disabilita Processo
    AuthorizationProcess_Timer.Enabled = False
    'Imposta parametri
    Dim PhoneSDK As Phone
    'Verifica Step autorizzazioni
    If PermissionsID_Step = 0 Then 'Posizione in Background
        PermissionsRequester.CheckAndRequest(PermissionsRequester.PERMISSION_ACCESS_COARSE_LOCATION)
    Else If PermissionsID_Step = 1 Then
        PermissionsRequester.CheckAndRequest(PermissionsRequester.PERMISSION_ACCESS_FINE_LOCATION)
    Else If PermissionsID_Step = 2 Then
        'Imposta autorizzazione successiva
        ExecuteLabelsBoxSliderAnimation(True, LabelsBoxSlider_AuthLabel1, LabelsBoxSlider_AuthLabel2)
        ExecuteAuthInfoBoxAnimation(True, 2, LabelsBoxSlider_AuthLabel2.Text, iControl.AuthorizationActivity_LabelsBoxSlider_AuthLabel2_InfoText)
    Else If PermissionsID_Step = 3 Then 'Gestione telefonate
        PermissionsRequester.CheckAndRequest(PermissionsRequester.PERMISSION_CALL_PHONE)
    Else If PermissionsID_Step = 4 Then
        PermissionsRequester.CheckAndRequest(PermissionsRequester.PERMISSION_READ_PHONE_STATE)
    Else If PermissionsID_Step = 5 Then
        'Imposta autorizzazione successiva
        ExecuteLabelsBoxSliderAnimation(True, LabelsBoxSlider_AuthLabel2, LabelsBoxSlider_AuthLabel3)
        ExecuteAuthInfoBoxAnimation(True, 3, LabelsBoxSlider_AuthLabel3.Text, iControl.AuthorizationActivity_LabelsBoxSlider_AuthLabel3_InfoText)
    Else If PermissionsID_Step = 6 Then 'Gestione contatti
        PermissionsRequester.CheckAndRequest(PermissionsRequester.PERMISSION_READ_CONTACTS)
    Else If PermissionsID_Step = 7 Then
        PermissionsRequester.CheckAndRequest(PermissionsRequester.PERMISSION_GET_ACCOUNTS)
    Else If PermissionsID_Step = 8 Then
        'Imposta autorizzazione successiva
        ExecuteLabelsBoxSliderAnimation(True, LabelsBoxSlider_AuthLabel3, LabelsBoxSlider_AuthLabel4)
        ExecuteAuthInfoBoxAnimation(True, 4, LabelsBoxSlider_AuthLabel4.Text, iControl.AuthorizationActivity_LabelsBoxSlider_AuthLabel4_InfoText)
    Else If PermissionsID_Step = 9 Then 'Lettura / Scrittura su memoria
        PermissionsRequester.CheckAndRequest(PermissionsRequester.PERMISSION_WRITE_EXTERNAL_STORAGE)
    Else If PermissionsID_Step = 10 Then
        'Imposta autorizzazione successiva
        ExecuteLabelsBoxSliderAnimation(True, LabelsBoxSlider_AuthLabel4, LabelsBoxSlider_AuthLabel5)
        ExecuteAuthInfoBoxAnimation(True, 5, LabelsBoxSlider_AuthLabel5.Text, iControl.AuthorizationActivity_LabelsBoxSlider_AuthLabel5_InfoText)
    Else If PermissionsID_Step = 11 Then 'Gestione microfoni
        PermissionsRequester.CheckAndRequest(PermissionsRequester.PERMISSION_RECORD_AUDIO)
    Else If PermissionsID_Step = 12 Then
        'Imposta autorizzazione successiva
        ExecuteLabelsBoxSliderAnimation(True, LabelsBoxSlider_AuthLabel5, LabelsBoxSlider_AuthLabel6)
        ExecuteAuthInfoBoxAnimation(True, 6, LabelsBoxSlider_AuthLabel6.Text, iControl.AuthorizationActivity_LabelsBoxSlider_AuthLabel6_InfoText)
    Else If PermissionsID_Step = 13 Then 'Fotocamere e Flash
        PermissionsRequester.CheckAndRequest(PermissionsRequester.PERMISSION_CAMERA)
    Else If PermissionsID_Step = 14 Then
        'Imposta autorizzazione successiva
        ExecuteLabelsBoxSliderAnimation(True, LabelsBoxSlider_AuthLabel6, LabelsBoxSlider_AuthLabel7)
        ExecuteAuthInfoBoxAnimation(True, 7, LabelsBoxSlider_AuthLabel7.Text, iControl.AuthorizationActivity_LabelsBoxSlider_AuthLabel7_InfoText)
    Else If PermissionsID_Step = 15 Then 'Attivita' fisica
        'Verifica SDK
        If PhoneSDK.SdkVersion >= 29 Then
            PermissionsRequester.CheckAndRequest("android.permission.ACTIVITY_RECOGNITION")
            PermissionsRequester.CheckAndRequest("android.permission.QUERY_ALL_PACKAGES")
        Else
            'Salta Passaggio
            ProcessStepperSkip
        End If
    Else If PermissionsID_Step = 16 Then
        'Salta Passaggio
        ProcessStepperSkip
    Else If PermissionsID_Step = 17 Then
        'Riavvia Software
        StartActivity(Main)
        'Chiudi
        Activity.Finish
    End If
End Sub
 

Attachments

  • Desktop_Screen1.png
    Desktop_Screen1.png
    132.9 KB · Views: 233
  • AndroidManifest.xml
    20.9 KB · Views: 228
Upvote 0

DavideTr94

Member
I removed that from the Manifest too. The only thing left is the RuntimePermission, which is apparently essential to be able to save the data in the private folder of the app itself. They advised me to wait a few days before sending a new update for review, it seems we have entered an automatic rejection cycle...?

This is the way a large company like Google works, all automated without the ability to request assistance :(

New Manifest:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="25" android:targetSdkVersion="30"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:largeHeap,"true")
SetServiceAttribute(StepCounterServices, android:foregroundServiceType, "location")
'End of default text.
'===== Supporto Notch =====
SetApplicationAttribute(android:theme, "@style/CustomTheme")

CreateResource(values, theme.xml,
<resources>
    <style name="CustomTheme" parent="@android:style/Theme.Holo.Light">
        <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
    </style>
</resources>)

'===== Imposta Launcher =====
AddActivityText(main, <intent-filter >
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.HOME" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>)
'===== Permessi =====
AddPermission(android.permission.USE_BIOMETRIC)
AddPermission("android.permission.ACCESS_NETWORK_STATE")
AddPermission("android.permission.ACCESS_LOCATION")
AddPermission("android.permission.ACCESS_GPS")
AddPermission("android.permission.ACCESS_ASSISTED_GPS")
AddPermission("android.permission.ACCESS_CELL_ID")
AddPermission("android.permission.ACCESS_COARSE_LOCATION")
AddPermission("android.permission.ACCESS_CHECKIN_PROPERTIES")
AddPermission("android.permission.ACCESS_LOCATION_EXTRA_COMMANDS")
AddPermission("android.permission.ACCESS_FINE_LOCATION")
AddPermission("android.permission.ACCESS_WIFI_STATE")
AddPermission("android.permission.BLUETOOTH_ADMIN")
AddPermission("android.permission.BLUETOOTH")
AddPermission("android.permission.BOOT_COMPLETED")
AddPermission("android.permission.CALL_PHONE")
AddPermission("android.permission.CALL_PRIVILEGED")
AddPermission("android.permission.CAMERA")
AddPermission("android.permission.CHANGE_WIFI_STATE")
AddPermission("android.permission.FLASHLIGHT")
AddPermission("android.permission_group.HARDWARE_CONTROLS")
AddPermission("android.permission.HARDWARE_TEST")
AddPermission("android.permission.INTERNET")
AddPermission("android.permission.MODIFY_PHONE_STATE")
AddPermission("android.permission.READ_PHONE_STATE")
AddPermission("android.permission.RECEIVE_BOOT_COMPLETED")
AddPermission("android.permission.SET_WALLPAPER")
AddPermission("android.permission.UPDATE_DEVICE_STATS")
AddPermission("android.permission.WAKE_LOCK")
AddPermission("android.permission.WRITE_SETTINGS")
AddPermission("android.permission.WRITE_SECURE_SETTINGS")
AddPermission("android.permission.REBOOT")
AddPermission("android.permission.NFC")
AddPermission("android.permission.CLEAR_APP_CACHE")
AddPermission("android.permission.READ_CONTACTS")
AddPermission("android.permission.RUN_INSTRUMENTATION")
AddPermission("android.permission.VIBRATE")
AddPermission("android.permission.CHANGE_NETWORK_STATE")
AddPermission("android.permission.ACCESS_COARSE_UPDATES")
AddPermission("android.permission.SET_WALLPAPER_HINTS")
AddPermission("android.permission.GET_ACCOUNTS")
AddPermission("android.permission.REQUEST_INSTALL_PACKAGES")
AddPermission("android.permission.BIND_DEVICE_ADMIN")
AddPermission("android.permission.EXPAND_STATUS_BAR")
AddPermission("android.permission.INTERACT_ACROSS_USERS_FULL")
AddPermission("android.permission.RECORD_AUDIO")
AddPermission("android.permission.REQUEST_DELETE_PACKAGES")
AddPermission(android.permission.GET_TASKS)
AddPermission(android.permission.DISABLE_KEYGUARD)
AddPermission(android.permission.ACCESS_BACKGROUND_LOCATION)
AddPermission(android.permission.ACCESS_CHECKIN_PROPERTIES)
AddPermission(android.permission.ACTIVITY_RECOGNITION)
AddPermission(android.permission.QUERY_ALL_PACKAGES)

AddManifestText(<uses-feature android:name="android.hardware.location.gps"/>)

'===== Autorizzazioni Rimosse =====
RemovePermission("android.permission.RECEIVE_SMS")
RemovePermission("android.permission.READ_SMS")
RemovePermission("android.permission.SEND_SMS")
RemovePermission("android.permission.WRITE_SMS")
RemovePermission("android.permission.RECEIVE_MMS")
RemovePermission("android.permission.READ_CALL_LOG")
RemovePermission("android.permission.PROCESS_OUTGOING_CALLS")
RemovePermission("android.permission.RECEIVE_WAP_PUSH")

'===== Informazioni Attività =====
SetActivityAttribute(Main, android:screenOrientation, "portrait")
SetActivityAttribute(Welcome, android:screenOrientation, "portrait")
SetActivityAttribute(GUIDownloader, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig1, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig2, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig3, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig4, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig5, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig6, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig7, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig8, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig9, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig10, android:screenOrientation, "portrait")
SetActivityAttribute(InitialConfig11, android:screenOrientation, "portrait")
SetActivityAttribute(InitialLanguageSelector, android:screenOrientation, "portrait")
SetActivityAttribute(Home, android:screenOrientation, "portrait")
SetActivityAttribute(LockScreen, android:screenOrientation, "portrait")
SetActivityAttribute(PhoneDialer, android:screenOrientation, "portrait")
SetActivityAttribute(FinishConfig, android:screenOrientation, "portrait")
SetActivityAttribute(UpdateInfoForm, android:screenOrientation, "portrait")
SetActivityAttribute(RecoveryMode, android:screenOrientation, "portrait")
SetActivityAttribute(BootFailActivity, android:screenOrientation, "portrait")
SetActivityAttribute(OperatorAlertActivity, android:screenOrientation, "portrait")
SetActivityAttribute(PhoneCallerID, android:screenOrientation, "portrait")
SetActivityAttribute(RestoreCodeActivity, android:screenOrientation, "portrait")
SetActivityAttribute(MemoryAlertActivity, android:screenOrientation, "portrait")
SetActivityAttribute(BugReportActivity, android:screenOrientation, "portrait")
'SetActivityAttribute(InAppControlCenter, android:theme, "@android:style/Theme.Translucent")
SetActivityAttribute(AppManagerInstallerActivity, android:screenOrientation, "portrait")
SetActivityAttribute(AdaptiveBoxActivity, android:screenOrientation, "portrait")
SetActivityAttribute(EmergencyDialerActivity, android:screenOrientation, "portrait")
SetActivityAttribute(RebootActivity, android:screenOrientation, "portrait")
SetActivityAttribute(AuthorizationActivity, android:screenOrientation, "portrait")
SetActivityAttribute(MaliciousAppsActivity, android:screenOrientation, "portrait")
SetActivityAttribute(TutorialActivity, android:screenOrientation, "portrait")
SetActivityAttribute(UpdateDownloaderActivity, android:screenOrientation, "portrait")
SetActivityAttribute(LangDownloaderActivity, android:screenOrientation, "portrait")
SetActivityAttribute(ThermalAlertActivity, android:screenOrientation, "portrait")
SetActivityAttribute(SubscriptionAlertActivity, android:screenOrientation, "portrait")
SetActivityAttribute(SubscriptionBuyActivity, android:screenOrientation, "portrait")
SetActivityAttribute(UserContractsActivity, android:screenOrientation, "portrait")
SetActivityAttribute(InitialSubscriptionSelectorActivity, android:screenOrientation, "portrait")
SetActivityAttribute(SubscriptionManagerActivity, android:screenOrientation, "portrait")
SetActivityAttribute(SubscriptionLostActivity, android:screenOrientation, "portrait")
SetActivityAttribute(MinimumRequirementsActivity, android:screenOrientation, "portrait")
SetActivityAttribute(SubscriptionDoubleAlertActivity, android:screenOrientation, "portrait")
SetActivityAttribute(AccountCheckerActivity, android:screenOrientation, "portrait")
SetActivityAttribute(SettingsCloudBackupActivity, android:screenOrientation, "portrait")
SetActivityAttribute(SetDefaultLauncherActivity, android:screenOrientation, "portrait")
SetActivityAttribute(DownloadManagerActivity, android:screenOrientation, "portrait")
SetActivityAttribute(GraphicDownloadActivity, android:screenOrientation, "portrait")
SetActivityAttribute(CloudCountdownActivity, android:screenOrientation, "portrait")
SetActivityAttribute(AlwaysOnDisplay_InitialConfig, android:screenOrientation, "portrait")
SetActivityAttribute(ChangeTextSizeActivity, android:screenOrientation, "portrait")
SetActivityAttribute(UpdateAlertActivity, android:screenOrientation, "portrait")
SetActivityAttribute(ConfigTypeSelectorActivity, android:screenOrientation, "portrait")
SetActivityAttribute(AppsManagerUninstallActivity, android:screenOrientation, "portrait")
SetActivityAttribute(RecoveryModeActivity, android:screenOrientation, "portrait")

'===== Singole Istanze =====
'SetActivityAttribute(Home, android:launchMode, "singleInstance")
'SetActivityAttribute(LockScreen, android:launchMode, "singleInstance")

SetActivityAttribute(Home, android:excludeFromRecents, "true")
SetActivityAttribute(LockScreen, android:excludeFromRecents, "true")
'===== Processo Notifiche =====
AddApplicationText(
<service android:name="anywheresoftware.b4a.objects.NotificationListenerWrapper"
   android:label="Professional UI"
  android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
  <intent-filter>
  <action android:name="android.service.notification.NotificationListenerService" />
  </intent-filter>
</service>)
'===== Amministratore =====
AddApplicationText(<receiver android:name="anywheresoftware.b4a.objects.AdminManager$AdminReceiver"
  android:permission="android.permission.BIND_DEVICE_ADMIN">
  <meta-data android:name="android.app.device_admin"
  android:resource="@xml/device_admin" />
  <intent-filter>
  <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
  </intent-filter>
</receiver>)

CreateResource(xml, device_admin.xml,
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
  <uses-policies>
  <limit-password />
  <reset-password />
  <force-lock />
  </uses-policies>
</device-admin>
)
'===== Permessi di Installazioni Esterne =====
AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)
CreateResource(xml, provider_paths,
   <external-files-path name="name" path="" />
)
'===== Gestione Abbonamenti =====
CreateResourceFromFile(Macro, GooglePlayBilling.GooglePlayBilling)
AddPermission("com.android.vending.BILLING")

'===== Gestione Tema di Sistema =====
SetApplicationAttribute(android:theme, "@style/Custom")
CreateResource(values-v20, theme.xml,
<resources>
  <style name="Custom" parent="@android:style/Theme.Material.Light.NoActionBar">
     <item name="android:windowTranslucentNavigation">false</item>
     <item name="android:windowTranslucentStatus">true</item>
     <item name="android:forceDarkAllowed">false</item>
  </style>
</resources>
)
'===== Gestione Dialer =====
'AddReceiverText(LockScreenCheck, <intent-filter>
'    <action android:name="android.intent.action.NEW_OUTGOING_CALL" />
'    <category android:name="android.intent.category.DEFAULT" />
'</intent-filter>)
 
Upvote 0

DavideTr94

Member
It is not needed.
I tried to remove the authorization request through RuntimePermission, as expected the app is unable to save any type of file and inevitably breaks.

For example, how can I create and access these folders if I don't request memory access permission via RuntimePermission?

Permission:
PermissionsRequester.CheckAndRequest(PermissionsRequester.PERMISSION_WRITE_EXTERNAL_STORAGE)

SW Folders:
Public RootSettings As String = File.DirDefaultExternal & "/.Professional_Launcher/" 'Percorso Impostazioni del Software
Public RootGUI As String = File.DirDefaultExternal & "/.Professional_Launcher/.graphicsEngine/" 'Percorso Risorse Motore Grafico
Public RootContacts As String = File.DirDefaultExternal & "/.Professional_Launcher/.Contacts/" 'Percorso Contatti
Public RootOperators As String = File.DirDefaultExternal & "/.Professional_Launcher/Operators/" 'Percorso Risorse Motore Grafico
Public RootAppsFiles As String = File.DirDefaultExternal & "/.Professional_Launcher/.AppsFiles/" 'Percorso Files Applicazioni
Public RootGlobalServiceBackup As String = File.DirDefaultExternal & "/.GlobalServiceBackup" 'Percorso Backup Impostazioni del Software
 
Upvote 0

DavideTr94

Member
Thanks, I solved that problem by inserting a similar thing for each Activity.

Solution:
Dim rp As RuntimePermissions
rp.GetSafeDirDefaultExternal("")

Now a similar problem has arisen with loading of User Wallpaper, in many parts of software the user default wallpaper is loaded in a PictureBox, the app crashes badly with this log:

Wallpaper Problem:
** Activity (bugreportactivity) Create, isFirst = true **
/storage/emulated/0/Android/data/com.blacksystem.professionallauncher/files/
(RemoteException) android.os.RemoteException: Remote stack trace:
    at android.app.ContextImpl.enforce(ContextImpl.java:1924)
    at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1952)
    at com.android.server.wallpaper.WallpaperManagerService.enforceCallingOrSelfPermissionAndAppOp(Unknown Source:2)
    at com.android.server.wallpaper.WallpaperManagerService.getWallpaper(Unknown Source:21)
    at android.app.IWallpaperManager$Stub.onTransact(IWallpaperManager.java:246)
bugreportactivity_getuserwallpaper (java line: 878)
java.lang.SecurityException: read wallpaper: Neither user 10351 nor current process has android.permission.READ_EXTERNAL_STORAGE.
    at android.os.Parcel.createException(Parcel.java:1966)
    at android.os.Parcel.readException(Parcel.java:1934)
    at android.os.Parcel.readException(Parcel.java:1884)
    at android.app.IWallpaperManager$Stub$Proxy.getWallpaper(IWallpaperManager.java:1174)
    at android.app.WallpaperManager$Globals.getCurrentWallpaperLocked(WallpaperManager.java:779)
    at android.app.WallpaperManager$Globals.peekWallpaperBitmap(WallpaperManager.java:714)
    at android.app.WallpaperManager$Globals.peekWallpaperBitmap(WallpaperManager.java:670)
    at android.app.WallpaperManager.getDrawable(WallpaperManager.java:976)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.agraham.reflection.Reflection.runmethod(Reflection.java:216)
    at anywheresoftware.b4a.agraham.reflection.Reflection.RunMethod(Reflection.java:802)
    at com.blacksystem.professionallauncher.bugreportactivity._getuserwallpaper(bugreportactivity.java:878)
    at com.blacksystem.professionallauncher.bugreportactivity._sethomewallpaper(bugreportactivity.java:1009)
    at com.blacksystem.professionallauncher.bugreportactivity._activity_create(bugreportactivity.java:467)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at com.blacksystem.professionallauncher.bugreportactivity.afterFirstLayout(bugreportactivity.java:105)
    at com.blacksystem.professionallauncher.bugreportactivity.access$000(bugreportactivity.java:17)
    at com.blacksystem.professionallauncher.bugreportactivity$WaitForLayout.run(bugreportactivity.java:83)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7073)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)

The interested part is this:

Get User Wallpaper:
Public Sub GetUserWallpaper(ImageElements As ImageView)
    'Carica Sfondo dell'utente
    Dim R As Reflector
    Dim b As Bitmap
    Dim d As BitmapDrawable
    Dim TempImage1 As BitmapDrawable
    b.InitializeMutable(Activity.Width,Activity.Height)
    d.Initialize(b)
    R.Target = R.RunStaticMethod("android.app.WallpaperManager", "getInstance", Array As Object(R.GetContext), Array As String("android.content.Context"))
    TempImage1 = R.RunMethod("getDrawable")
    'Imposta Sfondo Utente
    ImageElements.Bitmap = TempImage1.Bitmap
End Sub

How can I solve this problem? Thanks in advance :)
 
Upvote 0
Solution
Top