Commit 4432c9b6 authored by Sandeep Vijayasekar's avatar Sandeep Vijayasekar Committed by Commit Bot

Move ACTION_ENABLE_TOUCH_INPUT from CastIntents to CastWebContentsIntentUtils

Test: Build cast shell
Bug: internal b/69007670
Change-Id: I1771fe2f7112da7f80d2b8c345bb63beca92b9d2
Reviewed-on: https://chromium-review.googlesource.com/967519
Commit-Queue: Sandeep Vijayasekar <sandv@chromium.org>
Reviewed-by: default avatarLuke Halliwell <halliwell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543932}
parent 84832e75
...@@ -36,11 +36,4 @@ public class CastIntents { ...@@ -36,11 +36,4 @@ public class CastIntents {
*/ */
public static final String ACTION_ON_WEB_CONTENT_STOPPED = public static final String ACTION_ON_WEB_CONTENT_STOPPED =
"com.google.assistant.ON_WEB_CONTENT_STOPPED"; "com.google.assistant.ON_WEB_CONTENT_STOPPED";
/**
* Action type of intent from CastWebContentsComponent to notify CastWebContentsActivity that
* touch should be enabled.
*/
public static final String ACTION_ENABLE_TOUCH_INPUT =
"com.google.android.apps.castshell.intent.action.ENABLE_TOUCH_INPUT";
} }
...@@ -72,6 +72,13 @@ public class CastWebContentsIntentUtils { ...@@ -72,6 +72,13 @@ public class CastWebContentsIntentUtils {
static final String ACTION_REQUEST_MOVE_OUT = static final String ACTION_REQUEST_MOVE_OUT =
"com.google.android.apps.castshell.intent.action.REQUEST_MOVE_OUT"; "com.google.android.apps.castshell.intent.action.REQUEST_MOVE_OUT";
/**
* Action type of intent from CastWebContentsComponent to notify CastWebContentsActivity that
* touch should be enabled.
*/
public static final String ACTION_ENABLE_TOUCH_INPUT =
"com.google.android.apps.castshell.intent.action.ENABLE_TOUCH_INPUT";
/** Key of extra value in an intent, the value is a URI of cast://webcontents/<instanceId> */ /** Key of extra value in an intent, the value is a URI of cast://webcontents/<instanceId> */
static final String INTENT_EXTRA_URI = "content_uri"; static final String INTENT_EXTRA_URI = "content_uri";
...@@ -319,7 +326,7 @@ public class CastWebContentsIntentUtils { ...@@ -319,7 +326,7 @@ public class CastWebContentsIntentUtils {
// CastWebContentsComponent -> CastWebContentsSurfaceHelper and host activity of // CastWebContentsComponent -> CastWebContentsSurfaceHelper and host activity of
// CastWebContentsFragment // CastWebContentsFragment
public static Intent enableTouchInput(String instanceId, boolean enabled) { public static Intent enableTouchInput(String instanceId, boolean enabled) {
Intent intent = new Intent(CastIntents.ACTION_ENABLE_TOUCH_INPUT); Intent intent = new Intent(ACTION_ENABLE_TOUCH_INPUT);
intent.putExtra(INTENT_EXTRA_URI, getInstanceUri(instanceId).toString()); intent.putExtra(INTENT_EXTRA_URI, getInstanceUri(instanceId).toString());
intent.putExtra(INTENT_EXTRA_TOUCH_INPUT_ENABLED, enabled); intent.putExtra(INTENT_EXTRA_TOUCH_INPUT_ENABLED, enabled);
return intent; return intent;
......
...@@ -113,7 +113,7 @@ class CastWebContentsSurfaceHelper { ...@@ -113,7 +113,7 @@ class CastWebContentsSurfaceHelper {
// well. // well.
mTouchEnabledState.watch((Uri uri) -> { mTouchEnabledState.watch((Uri uri) -> {
IntentFilter filter = new IntentFilter(); IntentFilter filter = new IntentFilter();
filter.addAction(CastIntents.ACTION_ENABLE_TOUCH_INPUT); filter.addAction(CastWebContentsIntentUtils.ACTION_ENABLE_TOUCH_INPUT);
return new LocalBroadcastReceiverScope(filter, (Intent intent) -> { return new LocalBroadcastReceiverScope(filter, (Intent intent) -> {
String intentUri = CastWebContentsIntentUtils.getUriString(intent); String intentUri = CastWebContentsIntentUtils.getUriString(intent);
Log.d(TAG, "Intent action=" + intent.getAction() + "; URI=" + intentUri); Log.d(TAG, "Intent action=" + intent.getAction() + "; URI=" + intentUri);
......
...@@ -141,7 +141,8 @@ public class CastWebContentsComponentTest { ...@@ -141,7 +141,8 @@ public class CastWebContentsComponentTest {
Assume.assumeTrue(BuildConfig.DISPLAY_WEB_CONTENTS_IN_SERVICE); Assume.assumeTrue(BuildConfig.DISPLAY_WEB_CONTENTS_IN_SERVICE);
BroadcastReceiver receiver = Mockito.mock(BroadcastReceiver.class); BroadcastReceiver receiver = Mockito.mock(BroadcastReceiver.class);
IntentFilter intentFilter = new IntentFilter(CastIntents.ACTION_ENABLE_TOUCH_INPUT); IntentFilter intentFilter =
new IntentFilter(CastWebContentsIntentUtils.ACTION_ENABLE_TOUCH_INPUT);
LocalBroadcastManager.getInstance(ContextUtils.getApplicationContext()) LocalBroadcastManager.getInstance(ContextUtils.getApplicationContext())
.registerReceiver(receiver, intentFilter); .registerReceiver(receiver, intentFilter);
......
...@@ -202,7 +202,7 @@ public class CastWebContentsIntentUtilsTest { ...@@ -202,7 +202,7 @@ public class CastWebContentsIntentUtilsTest {
String uri = CastWebContentsIntentUtils.getUriString(in); String uri = CastWebContentsIntentUtils.getUriString(in);
Assert.assertNotNull(uri); Assert.assertNotNull(uri);
Assert.assertEquals(EXPECTED_URI, uri); Assert.assertEquals(EXPECTED_URI, uri);
Assert.assertEquals(CastIntents.ACTION_ENABLE_TOUCH_INPUT, in.getAction()); Assert.assertEquals(CastWebContentsIntentUtils.ACTION_ENABLE_TOUCH_INPUT, in.getAction());
Assert.assertTrue(CastWebContentsIntentUtils.isTouchable(in)); Assert.assertTrue(CastWebContentsIntentUtils.isTouchable(in));
} }
...@@ -212,7 +212,7 @@ public class CastWebContentsIntentUtilsTest { ...@@ -212,7 +212,7 @@ public class CastWebContentsIntentUtilsTest {
String uri = CastWebContentsIntentUtils.getUriString(in); String uri = CastWebContentsIntentUtils.getUriString(in);
Assert.assertNotNull(uri); Assert.assertNotNull(uri);
Assert.assertEquals(EXPECTED_URI, uri); Assert.assertEquals(EXPECTED_URI, uri);
Assert.assertEquals(CastIntents.ACTION_ENABLE_TOUCH_INPUT, in.getAction()); Assert.assertEquals(CastWebContentsIntentUtils.ACTION_ENABLE_TOUCH_INPUT, in.getAction());
Assert.assertFalse(CastWebContentsIntentUtils.isTouchable(in)); Assert.assertFalse(CastWebContentsIntentUtils.isTouchable(in));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment