1 // Copyright 2020 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 package org.chromium.chrome.browser.app.reengagement;
6 
7 import android.app.Activity;
8 import android.content.Intent;
9 import android.os.Bundle;
10 
11 import org.chromium.base.StrictModeContext;
12 import org.chromium.chrome.browser.IntentHandler;
13 import org.chromium.chrome.browser.reengagement.ReengagementNotificationController;
14 
15 /** Trampoline activity to start the NTP from the reengagement notification. */
16 public class ReengagementActivity extends Activity {
17     @Override
onCreate(Bundle savedInstanceState)18     protected void onCreate(Bundle savedInstanceState) {
19         super.onCreate(savedInstanceState);
20         String action = getIntent().getAction();
21         if (ReengagementNotificationController.LAUNCH_NTP_ACTION.equals(action)) {
22             Intent intent =
23                     IntentHandler.createTrustedOpenNewTabIntent(this, /* incognito = */ false);
24             try (StrictModeContext ignored = StrictModeContext.allowDiskWrites()) {
25                 startActivity(intent);
26             }
27         }
28         finish();
29     }
30 }
31