aboutsummaryrefslogtreecommitdiff
path: root/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/cluster
diff options
context:
space:
mode:
authorVitalii Tomkiv <vitalit@google.com>2016-03-24 15:17:17 -0700
committerVitalii Tomkiv <vitalit@google.com>2016-03-24 15:19:03 -0700
commitd4f4d754a116ef0d88f5aba5558429d9264c0fc8 (patch)
treeaa661c57102c085a4097b2598c24fa9f5fc526dd /tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/cluster
parent48a0b7c165e9dca6d37fb904165700fce17db4c4 (diff)
downloadCar-d4f4d754a116ef0d88f5aba5558429d9264c0fc8.tar.gz
API review: CarAppContextManager.
- Separate context change listener from ownership listener. Some apps may just want to monitor the state. Bug: 27598924 Change-Id: I496596b04273e943489e424760fff6764009f959
Diffstat (limited to 'tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/cluster')
-rw-r--r--tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/cluster/InstrumentClusterFragment.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/cluster/InstrumentClusterFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/cluster/InstrumentClusterFragment.java
index f3bc327cf9..0c633a4707 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/cluster/InstrumentClusterFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/cluster/InstrumentClusterFragment.java
@@ -22,6 +22,7 @@ import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.car.CarAppContextManager;
import android.support.car.CarAppContextManager.AppContextChangeListener;
+import android.support.car.CarAppContextManager.AppContextOwnershipChangeListener;
import android.support.car.CarNotConnectedException;
import android.support.car.navigation.CarNavigationManager;
import android.support.v4.app.Fragment;
@@ -86,7 +87,9 @@ public class InstrumentClusterFragment extends Fragment {
public void onAppContextChange(int activeContexts) {
Log.d(TAG, "onAppContextChange, activeContexts: " + activeContexts);
}
+ }, CarAppContextManager.APP_CONTEXT_NAVIGATION);
+ mCarAppContextManager.setActiveContexts(new AppContextOwnershipChangeListener() {
@Override
public void onAppContextOwnershipLoss(int context) {
Log.w(TAG, "onAppContextOwnershipLoss, context: " + context);
@@ -97,8 +100,6 @@ public class InstrumentClusterFragment extends Fragment {
.show();
}
}, CarAppContextManager.APP_CONTEXT_NAVIGATION);
-
- mCarAppContextManager.setActiveContexts(CarAppContextManager.APP_CONTEXT_NAVIGATION);
boolean ownsContext =
mCarAppContextManager.isOwningContext(CarAppContextManager.APP_CONTEXT_NAVIGATION);
Log.d(TAG, "Owns APP_CONTEXT_NAVIGATION: " + ownsContext);