Skip to content

Commit

Permalink
Rename AAE to automotive
Browse files Browse the repository at this point in the history
Fix: 130746725
Fix: 130887813
Test: Manual

Change-Id: Iaa04fce13ffe6532bdeb53d80df470e98868befb
  • Loading branch information
Peter Li committed Apr 20, 2019
1 parent 1b9449e commit 077067c
Show file tree
Hide file tree
Showing 37 changed files with 34 additions and 37 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.android.uamp.aae;
package com.example.android.uamp.automotive;

import android.content.Context;

Expand All @@ -38,6 +38,6 @@ public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.example.aae", appContext.getPackageName());
assertEquals("com.example.automotive", appContext.getPackageName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.android.uamp.aae">
package="com.example.android.uamp.automotive">

<!--
Since this module contains code exclusive to Android Auto Embedded, require the feature here.
Since this module contains code exclusive to Android Automotive, require the feature here.
If you were mixing projected and embedded code, then the feature should not be marked
If you were mixing projected and automotive code, then the feature should not be marked
as required.
-->
<uses-feature
Expand Down Expand Up @@ -59,11 +59,11 @@
</activity>

<!--
Declare the MediaBrowserService which supports Android Auto Embedded specific
Declare the MediaBrowserService which supports Android Automotive specific
extensions.
-->
<service
android:name=".AaeMusicService"
android:name=".AutomotiveMusicService"
android:enabled="true"
android:exported="true"
tools:ignore="ExportedService">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.android.uamp.aae
package com.example.android.uamp.automotive

import android.accounts.AccountManager
import android.app.Activity
Expand All @@ -32,18 +32,18 @@ import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector
import kotlinx.coroutines.ExperimentalCoroutinesApi

/** UAMP specific command for logging into the service. */
const val LOGIN = "com.example.android.uamp.aae.COMMAND.LOGIN"
const val LOGIN = "com.example.android.uamp.automotive.COMMAND.LOGIN"

/** UAMP specific command for logging out of the service. */
const val LOGOUT = "com.example.android.uamp.aae.COMMAND.LOGOUT"
const val LOGOUT = "com.example.android.uamp.automotive.COMMAND.LOGOUT"

const val LOGIN_EMAIL = "com.example.android.uamp.aae.ARGS.LOGIN_EMAIL"
const val LOGIN_PASSWORD = "com.example.android.uamp.aae.ARGS.LOGIN_PASSWORD"
const val LOGIN_EMAIL = "com.example.android.uamp.automotive.ARGS.LOGIN_EMAIL"
const val LOGIN_PASSWORD = "com.example.android.uamp.automotive.ARGS.LOGIN_PASSWORD"

typealias CommandHandler = (parameters: Bundle) -> Int

/**
* Android Auto Embedded specific extensions for [MusicService].
* Android Automotive specific extensions for [MusicService].
*
* UAMP for Android Automotive OS requires the user to login in order to demonstrate
* how authentication works on the system. If this doesn't apply to your application,
Expand All @@ -52,11 +52,9 @@ typealias CommandHandler = (parameters: Bundle) -> Int
* If you'd like to support authentication, but not prevent using the system,
* comment out the calls to [requireLogin].
*/
class AaeMusicService : MusicService() {

class AutomotiveMusicService : MusicService() {
private var isAuthenticated = false


@ExperimentalCoroutinesApi
override fun onCreate() {
super.onCreate()
Expand All @@ -71,15 +69,15 @@ class AaeMusicService : MusicService() {

private fun onLogin(email: String, password: String): Boolean {
Log.i(TAG, "User logged in: $email")
getSharedPreferences(AaeMusicService::class.java.name, Context.MODE_PRIVATE).edit {
getSharedPreferences(AutomotiveMusicService::class.java.name, Context.MODE_PRIVATE).edit {
putString(USER_TOKEN, "$email:${password.hashCode()}")
}
return true
}

private fun onLogout(): Boolean {
Log.i(TAG, "User logged out")
getSharedPreferences(AaeMusicService::class.java.name, Context.MODE_PRIVATE).edit {
getSharedPreferences(AutomotiveMusicService::class.java.name, Context.MODE_PRIVATE).edit {
remove(USER_TOKEN)
}
return false
Expand All @@ -91,7 +89,7 @@ class AaeMusicService : MusicService() {
* [AccountManager] APIs.
*/
private fun verifyLogin() =
getSharedPreferences(AaeMusicService::class.java.name, Context.MODE_PRIVATE)
getSharedPreferences(AutomotiveMusicService::class.java.name, Context.MODE_PRIVATE)
.contains(USER_TOKEN)

/**
Expand Down Expand Up @@ -169,10 +167,10 @@ class AaeMusicService : MusicService() {
}
}

private const val TAG = "AaeMusicService"
private const val TAG = "AutomotiveMusicService"
private const val ERROR_RESOLUTION_ACTION_LABEL =
"android.media.extras.ERROR_RESOLUTION_ACTION_LABEL"
private const val ERROR_RESOLUTION_ACTION_INTENT =
"android.media.extras.ERROR_RESOLUTION_ACTION_INTENT"

private const val USER_TOKEN = "com.example.android.uamp.aae.PREFS.USER_TOKEN"
private const val USER_TOKEN = "com.example.android.uamp.automotive.PREFS.USER_TOKEN"
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.android.uamp.aae
package com.example.android.uamp.automotive

import android.app.Activity
import android.app.Application
Expand All @@ -35,10 +35,10 @@ import com.example.android.uamp.common.MediaSessionConnection
import com.example.android.uamp.media.MusicService

/**
* This class mocks the sign in flow for integration with MediaCenter in Android Auto Embedded.
* This class mocks the sign in flow for integration with MediaCenter in Android Automotive.
*
* This activity will be launched by AAE MediaCenter via PendingIntent set in the playback
* state in [MusicService.verifyLoginStatus].
* This activity will be launched by Android Automotive MediaCenter via PendingIntent set in the
* playback state in [MusicService.verifyLoginStatus].
*/
class LoginActivity : AppCompatActivity() {
private lateinit var inputEmail: EditText
Expand Down Expand Up @@ -82,7 +82,7 @@ class LoginActivityViewModel(application: Application) : AndroidViewModel(applic
private val applicationContext = application.applicationContext
private val mediaSessionConnection = MediaSessionConnection(
applicationContext,
ComponentName(applicationContext, AaeMusicService::class.java)
ComponentName(applicationContext, AutomotiveMusicService::class.java)
)

private val _loggedIn = MutableLiveData<Boolean>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

package com.example.android.uamp.aae
package com.example.android.uamp.automotive

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar

/**
* This class exposes application settings
* for integration with MediaCenter in Android Auto Embedded.
* for integration with MediaCenter in Android Automotive.
*/
class SettingsActivity : AppCompatActivity() {
private lateinit var toolbar: Toolbar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.android.uamp.aae
package com.example.android.uamp.automotive

import android.app.Application
import android.content.ComponentName
Expand All @@ -24,7 +24,6 @@ import androidx.lifecycle.ViewModelProviders
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import com.example.android.uamp.common.MediaSessionConnection
import com.example.android.uamp.media.MusicService

/**
* Preference fragment hosted by [SettingsActivity]. Handles events to various preference changes.
Expand Down Expand Up @@ -62,7 +61,7 @@ class SettingsFragmentViewModel(application: Application) : AndroidViewModel(app
private val applicationContext = application.applicationContext
private val mediaSessionConnection = MediaSessionConnection(
applicationContext,
ComponentName(applicationContext, AaeMusicService::class.java)
ComponentName(applicationContext, AutomotiveMusicService::class.java)
)

fun logout() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<EditText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_width="400dp"
android:layout_height="wrap_content"
android:hint="@string/email_hint"
android:inputType="textEmailAddress"
Expand All @@ -33,7 +33,7 @@

<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_width="400dp"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:hint="@string/password_hint"
Expand All @@ -48,7 +48,7 @@
<Button
android:id="@+id/sign_in_button"
style="?android:textAppearanceSmall"
android:layout_width="match_parent"
android:layout_width="400dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="@color/colorAccent"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.android.uamp.aae;
package com.example.android.uamp.automotive;

import org.junit.Test;

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ buildscript {

// Dependency versions.
androidx_app_compat_version = '1.1.0-alpha04'
androidx_car_version = '1.0.0-alpha7'
androidx_car_version = '1.0.0-alpha5'
androidx_core_ktx_version = '1.0.1'
androidx_media_version = '1.0.1'
androidx_preference_version = '1.0.0'
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ if (extraSettings.exists()) {
apply from: extraSettings
}

include ':app', ':common', ':aae'
include ':app', ':common', ':automotive'

0 comments on commit 077067c

Please sign in to comment.