Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<!-- Add this permission for accessibility service -->
<uses-permission android:name="android.permission.BIND_ACCESSIBILITY_SERVICE" />

<application
android:allowBackup="true"
Expand All @@ -32,10 +34,21 @@
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

<!-- Add the accessibility service configuration -->
<service
android:name=".ScreenOperatorAccessibilityService"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
android:exported="true">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
<meta-data
android:name="android.accessibilityservice"
android:resource="@xml/accessibility_service_config" />
</service>
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import android.accessibilityservice.AccessibilityService
import android.view.accessibility.AccessibilityEvent
import android.util.Log

class ScreenOperatorAccessibilityService : AccessibilityService() {
private val TAG = "ScreenOperatorService"

override fun onAccessibilityEvent(event: AccessibilityEvent) {
// Handle accessibility events here
Log.d(TAG, "Received accessibility event: ${event.eventType}")
}

override fun onInterrupt() {
// Handle interruption of the accessibility service
Log.d(TAG, "Accessibility service interrupted")
}

override fun onServiceConnected() {
super.onServiceConnected()
// Service is connected, perform any initial setup here
Log.d(TAG, "Accessibility service connected")
}
}
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@
<!-- Chat sample strings -->
<string name="chat_label">Message</string>
<string name="action_send">Send</string>

<!-- Screen Operator -->
<string name="accessibility_service_description">Screen Operator accessibility service for automated screen operations</string>

</resources>
10 changes: 10 additions & 0 deletions app/src/main/res/xml/accessibility_service_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/accessibility_service_description"
android:packageNames="com.your.package.name"
android:accessibilityEventTypes="typeAllMask"
android:accessibilityFlags="flagDefault"
android:accessibilityFeedbackType="feedbackSpoken"
android:notificationTimeout="100"
android:canRetrieveWindowContent="true"
android:settingsActivity="com.your.package.name.MainActivity"/>