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 {
*/
public static final String ACTION_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 {
static final String 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> */
static final String INTENT_EXTRA_URI = "content_uri";
......@@ -319,7 +326,7 @@ public class CastWebContentsIntentUtils {
// CastWebContentsComponent -> CastWebContentsSurfaceHelper and host activity of
// CastWebContentsFragment
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_TOUCH_INPUT_ENABLED, enabled);
return intent;
......
......@@ -113,7 +113,7 @@ class CastWebContentsSurfaceHelper {
// well.
mTouchEnabledState.watch((Uri uri) -> {
IntentFilter filter = new IntentFilter();
filter.addAction(CastIntents.ACTION_ENABLE_TOUCH_INPUT);
filter.addAction(CastWebContentsIntentUtils.ACTION_ENABLE_TOUCH_INPUT);
return new LocalBroadcastReceiverScope(filter, (Intent intent) -> {
String intentUri = CastWebContentsIntentUtils.getUriString(intent);
Log.d(TAG, "Intent action=" + intent.getAction() + "; URI=" + intentUri);
......
......@@ -141,7 +141,8 @@ public class CastWebContentsComponentTest {
Assume.assumeTrue(BuildConfig.DISPLAY_WEB_CONTENTS_IN_SERVICE);
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())
.registerReceiver(receiver, intentFilter);
......
......@@ -202,7 +202,7 @@ public class CastWebContentsIntentUtilsTest {
String uri = CastWebContentsIntentUtils.getUriString(in);
Assert.assertNotNull(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));
}
......@@ -212,7 +212,7 @@ public class CastWebContentsIntentUtilsTest {
String uri = CastWebContentsIntentUtils.getUriString(in);
Assert.assertNotNull(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));
}
......
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