Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit af377b6

Browse files
zhongqiliangColin Liang
and
Colin Liang
authoredMar 21, 2025··
Standardize Launch URL to Kabuki Home (#5148)
1. Ensuring Cobalt launches with the Kabuki home page URL even with intent deep links. Kabuki is now solely responsible for consuming and navigating to the deep link destination. 2. Removes the Android Activity's preservation of the last viewed URL (ACTIVE_SHELL_URL_KEY). Kabuki should manage this state internally if needed. b/405227449 Co-authored-by: Colin Liang <colinliang@google.com>
1 parent a6e5022 commit af377b6

File tree

1 file changed

+2
-29
lines changed

1 file changed

+2
-29
lines changed
 

‎cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltActivity.java

+2-29
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public abstract class CobaltActivity extends Activity {
6868
private static final String URL_ARG = "--url=";
6969
private static final java.lang.String META_DATA_APP_URL = "cobalt.APP_URL";
7070

71-
private static final String ACTIVE_SHELL_URL_KEY = "activeUrl";
7271
public static final String COMMAND_LINE_ARGS_KEY = "commandLineArgs";
7372

7473
private static final Pattern URL_PARAM_PATTERN = Pattern.compile("^[a-zA-Z0-9_=]*$");
@@ -186,9 +185,6 @@ protected void createContent(final Bundle savedInstanceState) {
186185
mWindowAndroid.setAnimationPlaceholderView(
187186
mShellManager.getContentViewRenderView().getSurfaceView());
188187

189-
if (mStartupUrl == null || mStartupUrl.isEmpty()) {
190-
mStartupUrl = getUrlFromIntent(getIntent());
191-
}
192188
if (mStartupUrl == null || mStartupUrl.isEmpty()) {
193189
String[] args = getStarboardBridge().getArgs();
194190
mStartupUrl =
@@ -226,16 +222,6 @@ public void onFailure() {
226222

227223
// Initially copied from ContentShellActiviy.java
228224
private void finishInitialization(Bundle savedInstanceState) {
229-
String shellUrl;
230-
if (!TextUtils.isEmpty(mStartupUrl)) {
231-
shellUrl = mStartupUrl;
232-
} else {
233-
shellUrl = ShellManager.DEFAULT_SHELL_URL;
234-
}
235-
236-
if (savedInstanceState != null && savedInstanceState.containsKey(ACTIVE_SHELL_URL_KEY)) {
237-
shellUrl = savedInstanceState.getString(ACTIVE_SHELL_URL_KEY);
238-
}
239225
// Set to overlay video mode.
240226
mShellManager.getContentViewRenderView().setOverlayVideoMode(true);
241227

@@ -246,8 +232,8 @@ private void finishInitialization(Bundle savedInstanceState) {
246232
getStarboardBridge().setWebContents(getActiveWebContents());
247233

248234
// Load the `url` with the same shell we created above.
249-
Log.i(TAG, "shellManager load url:" + shellUrl);
250-
mShellManager.getActiveShell().loadUrl(shellUrl);
235+
Log.i(TAG, "shellManager load url:" + mStartupUrl);
236+
mShellManager.getActiveShell().loadUrl(mStartupUrl);
251237
}
252238

253239
// Initially copied from ContentShellActiviy.java
@@ -259,19 +245,6 @@ private void initializationFailed() {
259245
finish();
260246
}
261247

262-
// Initially copied from ContentShellActiviy.java
263-
@Override
264-
protected void onSaveInstanceState(Bundle outState) {
265-
super.onSaveInstanceState(outState);
266-
WebContents webContents = getActiveWebContents();
267-
if (webContents != null) {
268-
// TODO(yfriedman): crbug/783819 - This should use GURL serialize/deserialize.
269-
outState.putString(ACTIVE_SHELL_URL_KEY, webContents.getLastCommittedUrl().getSpec());
270-
}
271-
272-
mIntentRequestTracker.saveInstanceState(outState);
273-
}
274-
275248
protected static Optional<KeyEvent> getRemappedKeyEvent(int keyCode, int action) {
276249
int mappedKeyCode;
277250
if (keyCode == KeyEvent.KEYCODE_BACK) {

0 commit comments

Comments
 (0)
Please sign in to comment.