Skip to content

Commit

Permalink
Remove assistant app/Assist with button on Automotive (#4965)
Browse files Browse the repository at this point in the history
Remove assistant app on Automotive
  • Loading branch information
jpelgrom authored Jan 10, 2025
1 parent de6d1ee commit 2df451c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ class SettingsFragment(
val isAutomotive =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && requireContext().packageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)

findPreference<PreferenceCategory>("assist")?.isVisible = !isAutomotive

findPreference<PreferenceCategory>("widgets")?.isVisible = Build.MODEL != "Quest" && !isAutomotive
findPreference<Preference>("manage_widgets")?.setOnPreferenceClickListener {
parentFragmentManager.commit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,13 @@ class SettingsPresenterImpl @Inject constructor(

// Assist
var assistantSuggestion = serverManager.defaultServers.any { it.version?.isAtLeast(2023, 5) == true }
assistantSuggestion = if (assistantSuggestion && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
assistantSuggestion = if (
assistantSuggestion &&
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
context.packageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)
) {
false
} else if (assistantSuggestion && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
val roleManager = context.getSystemService<RoleManager>()
roleManager?.isRoleAvailable(RoleManager.ROLE_ASSISTANT) == true && !roleManager.isRoleHeld(RoleManager.ROLE_ASSISTANT)
} else if (assistantSuggestion && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
Expand Down
13 changes: 0 additions & 13 deletions automotive/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -423,20 +423,7 @@
android:autoRemoveFromRecents="true"
android:showWhenLocked="true"
android:theme="@style/Theme.HomeAssistant.Assist">
<intent-filter>
<action android:name="android.intent.action.ASSIST" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity-alias
android:name=".assist.VoiceCommandIntentActivity"
android:targetActivity=".assist.AssistActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VOICE_COMMAND" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity-alias>

<provider
android:name="androidx.core.content.FileProvider"
Expand Down

0 comments on commit 2df451c

Please sign in to comment.