OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.document; | 5 package org.chromium.chrome.browser.document; |
6 | 6 |
7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.app.Activity; | 8 import android.app.Activity; |
9 import android.app.Notification; | 9 import android.app.Notification; |
10 import android.app.SearchManager; | 10 import android.app.SearchManager; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 /** | 110 /** |
111 * Figure out how to route the Intent. Because this is on the critical path
to startup, please | 111 * Figure out how to route the Intent. Because this is on the critical path
to startup, please |
112 * avoid making the pathway any more complicated than it already is. Make s
ure that anything | 112 * avoid making the pathway any more complicated than it already is. Make s
ure that anything |
113 * you add _absolutely has_ to be here. | 113 * you add _absolutely has_ to be here. |
114 */ | 114 */ |
115 @Override | 115 @Override |
116 public void onCreate(Bundle savedInstanceState) { | 116 public void onCreate(Bundle savedInstanceState) { |
117 // Third-party code adds disk access to Activity.onCreate. http://crbug.
com/619824 | 117 // Third-party code adds disk access to Activity.onCreate. http://crbug.
com/619824 |
118 StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); | 118 StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); |
| 119 TraceEvent.begin("ChromeLauncherActivity"); |
| 120 TraceEvent.begin("ChromeLauncherActivity.onCreate"); |
119 try { | 121 try { |
120 super.onCreate(savedInstanceState); | 122 doOnCreate(savedInstanceState); |
121 } finally { | 123 } finally { |
122 StrictMode.setThreadPolicy(oldPolicy); | 124 StrictMode.setThreadPolicy(oldPolicy); |
| 125 TraceEvent.end("ChromeLauncherActivity.onCreate"); |
123 } | 126 } |
| 127 } |
| 128 |
| 129 private final void doOnCreate(Bundle savedInstanceState) { |
| 130 super.onCreate(savedInstanceState); |
124 // This Activity is only transient. It launches another activity and | 131 // This Activity is only transient. It launches another activity and |
125 // terminates itself. However, some of the work is performed outside of | 132 // terminates itself. However, some of the work is performed outside of |
126 // {@link Activity#onCreate()}. To capture this, the TraceEvent starts | 133 // {@link Activity#onCreate()}. To capture this, the TraceEvent starts |
127 // in onCreate(), and ends in onPause(). | 134 // in onCreate(), and ends in onPause(). |
128 TraceEvent.begin("ChromeLauncherActivity"); | |
129 // Needs to be called as early as possible, to accurately capture the | 135 // Needs to be called as early as possible, to accurately capture the |
130 // time at which the intent was received. | 136 // time at which the intent was received. |
131 IntentHandler.addTimestampToIntent(getIntent()); | 137 IntentHandler.addTimestampToIntent(getIntent()); |
132 // Initialize the command line in case we've disabled document mode from
there. | 138 // Initialize the command line in case we've disabled document mode from
there. |
133 CommandLineInitUtil.initCommandLine(this, ChromeApplication.COMMAND_LINE
_FILE); | 139 CommandLineInitUtil.initCommandLine(this, ChromeApplication.COMMAND_LINE
_FILE); |
134 | 140 |
135 // Read partner browser customizations information asynchronously. | 141 // Read partner browser customizations information asynchronously. |
136 // We want to initialize early because when there is no tabs to restore,
we should possibly | 142 // We want to initialize early because when there is no tabs to restore,
we should possibly |
137 // show homepage, which might require reading PartnerBrowserCustomizatio
ns provider. | 143 // show homepage, which might require reading PartnerBrowserCustomizatio
ns provider. |
138 PartnerBrowserCustomizations.initializeAsync(getApplicationContext(), | 144 PartnerBrowserCustomizations.initializeAsync(getApplicationContext(), |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 return; | 230 return; |
225 } | 231 } |
226 | 232 |
227 // All possible bounces to other activities should have already been enu
merated above. | 233 // All possible bounces to other activities should have already been enu
merated above. |
228 Log.e(TAG, "User wasn't sent to another Activity."); | 234 Log.e(TAG, "User wasn't sent to another Activity."); |
229 assert false; | 235 assert false; |
230 ApiCompatibilityUtils.finishAndRemoveTask(this); | 236 ApiCompatibilityUtils.finishAndRemoveTask(this); |
231 } | 237 } |
232 | 238 |
233 @Override | 239 @Override |
234 public void onPause() { | 240 public void onDestroy() { |
235 super.onPause(); | 241 super.onDestroy(); |
236 TraceEvent.end("ChromeLauncherActivity"); | 242 TraceEvent.end("ChromeLauncherActivity"); |
237 } | 243 } |
238 | 244 |
239 @Override | 245 @Override |
240 protected void onActivityResult(int requestCode, int resultCode, Intent data
) { | 246 protected void onActivityResult(int requestCode, int resultCode, Intent data
) { |
241 super.onActivityResult(requestCode, resultCode, data); | 247 super.onActivityResult(requestCode, resultCode, data); |
242 if (requestCode == FIRST_RUN_EXPERIENCE_REQUEST_CODE) { | 248 if (requestCode == FIRST_RUN_EXPERIENCE_REQUEST_CODE) { |
243 if (resultCode == Activity.RESULT_OK) { | 249 if (resultCode == Activity.RESULT_OK) { |
244 // User might have opted out during FRE, so check again. | 250 // User might have opted out during FRE, so check again. |
245 if (mIsCustomTabIntent) { | 251 if (mIsCustomTabIntent) { |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 IntentHandler.ExternalAppId source = | 500 IntentHandler.ExternalAppId source = |
495 IntentHandler.determineExternalIntentSource(getPackageName(), in
tent); | 501 IntentHandler.determineExternalIntentSource(getPackageName(), in
tent); |
496 if (intent.getPackage() == null && source != IntentHandler.ExternalAppId
.CHROME) { | 502 if (intent.getPackage() == null && source != IntentHandler.ExternalAppId
.CHROME) { |
497 int flagsOfInterest = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_AC
TIVITY_NEW_DOCUMENT; | 503 int flagsOfInterest = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_AC
TIVITY_NEW_DOCUMENT; |
498 int maskedFlags = intent.getFlags() & flagsOfInterest; | 504 int maskedFlags = intent.getFlags() & flagsOfInterest; |
499 sIntentFlagsHistogram.record(maskedFlags); | 505 sIntentFlagsHistogram.record(maskedFlags); |
500 } | 506 } |
501 MediaNotificationUma.recordClickSource(intent); | 507 MediaNotificationUma.recordClickSource(intent); |
502 } | 508 } |
503 } | 509 } |
OLD | NEW |