#Region Service Attributes
#StartAtBoot: false
#End Region
#Extends: com.tillekesoft.accessibilityservices.AccessibilityEventsListenerWrapper
Sub Process_Globals
Public AccessibilitySevices As AccessibilityEventsListener
Private AccessibilitySevicesCostants As AccessibilityConstants
'Public PowerDialogShowed As Boolean = False
End Sub
Sub Service_Create
'Inizializzo il servizio
AccessibilitySevices.initialize("Accessibility")
End Sub
'Sub Accessibility_OnAccessibilityEvent (Event As Object, node As Object)
'
' '***QUESTO EVENTO VIENE SEMPRE RICHIAMATO DA QUALSIASI AZIONE SULL'APP USARE PowerDialogShowed = TRUE PER NON ENTRARCI NUOVAMENTE SE NO COMPAIONO
' 'PIU' POWERMENU
'
' 'Visualizzo il dialog dello spegnimento
' If PowerDialogShowed = False Then
' PowerDialogShowed = True
' AccessibilitySevices.PerformGlobalAction(AccessibilitySevicesCostants.GLOBAL_ACTION_POWER_DIALOG )
' CallSubDelayed(Main,"Application_Exit")
' End If
'
'End Sub
Sub Show_PowerMenu
AccessibilitySevices.PerformGlobalAction(AccessibilitySevicesCostants.GLOBAL_ACTION_POWER_DIALOG)
CallSubDelayed(Main,"Application_Exit")
End Sub
Sub Service_Start (StartingIntent As Intent)
Service.StopAutomaticForeground
End Sub
Sub Service_Destroy
End Sub
Sub Check_ServiceEnabled
'SERVE A VISUALIZZARE LA SCHERMATA DI CONSENSO ALL'UTILIZZO DI ACCESSIBILITYSERVICES
If AccessibilitySevices.IsAccessibilityServiceEnabled("xx.xxxxxx.powermenu/.accserv") = False Then
Dim Intent1 As Intent
Intent1.Initialize( "android.settings.ACCESSIBILITY_SETTINGS", "" )
StartActivity( Intent1 )
Else
'se il servizio è abilitato visualizzo il PowerMenu
Show_PowerMenu
End If
End Sub