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"); | |
121 try { | 119 try { |
122 doOnCreate(savedInstanceState); | 120 super.onCreate(savedInstanceState); |
123 } finally { | 121 } finally { |
124 StrictMode.setThreadPolicy(oldPolicy); | 122 StrictMode.setThreadPolicy(oldPolicy); |
125 TraceEvent.end("ChromeLauncherActivity.onCreate"); | |
126 } | 123 } |
127 } | |
128 | |
129 private final void doOnCreate(Bundle savedInstanceState) { | |
130 super.onCreate(savedInstanceState); | |
131 // This Activity is only transient. It launches another activity and | 124 // This Activity is only transient. It launches another activity and |
132 // terminates itself. However, some of the work is performed outside of | 125 // terminates itself. However, some of the work is performed outside of |
133 // {@link Activity#onCreate()}. To capture this, the TraceEvent starts | 126 // {@link Activity#onCreate()}. To capture this, the TraceEvent starts |
134 // in onCreate(), and ends in onPause(). | 127 // in onCreate(), and ends in onPause(). |
| 128 TraceEvent.begin("ChromeLauncherActivity"); |
135 // Needs to be called as early as possible, to accurately capture the | 129 // Needs to be called as early as possible, to accurately capture the |
136 // time at which the intent was received. | 130 // time at which the intent was received. |
137 IntentHandler.addTimestampToIntent(getIntent()); | 131 IntentHandler.addTimestampToIntent(getIntent()); |
138 // Initialize the command line in case we've disabled document mode from
there. | 132 // Initialize the command line in case we've disabled document mode from
there. |
139 CommandLineInitUtil.initCommandLine(this, ChromeApplication.COMMAND_LINE
_FILE); | 133 CommandLineInitUtil.initCommandLine(this, ChromeApplication.COMMAND_LINE
_FILE); |
140 | 134 |
141 // Read partner browser customizations information asynchronously. | 135 // Read partner browser customizations information asynchronously. |
142 // We want to initialize early because when there is no tabs to restore,
we should possibly | 136 // We want to initialize early because when there is no tabs to restore,
we should possibly |
143 // show homepage, which might require reading PartnerBrowserCustomizatio
ns provider. | 137 // show homepage, which might require reading PartnerBrowserCustomizatio
ns provider. |
144 PartnerBrowserCustomizations.initializeAsync(getApplicationContext(), | 138 PartnerBrowserCustomizations.initializeAsync(getApplicationContext(), |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 return; | 224 return; |
231 } | 225 } |
232 | 226 |
233 // All possible bounces to other activities should have already been enu
merated above. | 227 // All possible bounces to other activities should have already been enu
merated above. |
234 Log.e(TAG, "User wasn't sent to another Activity."); | 228 Log.e(TAG, "User wasn't sent to another Activity."); |
235 assert false; | 229 assert false; |
236 ApiCompatibilityUtils.finishAndRemoveTask(this); | 230 ApiCompatibilityUtils.finishAndRemoveTask(this); |
237 } | 231 } |
238 | 232 |
239 @Override | 233 @Override |
240 public void onDestroy() { | 234 public void onPause() { |
241 super.onDestroy(); | 235 super.onPause(); |
242 TraceEvent.end("ChromeLauncherActivity"); | 236 TraceEvent.end("ChromeLauncherActivity"); |
243 } | 237 } |
244 | 238 |
245 @Override | 239 @Override |
246 protected void onActivityResult(int requestCode, int resultCode, Intent data
) { | 240 protected void onActivityResult(int requestCode, int resultCode, Intent data
) { |
247 super.onActivityResult(requestCode, resultCode, data); | 241 super.onActivityResult(requestCode, resultCode, data); |
248 if (requestCode == FIRST_RUN_EXPERIENCE_REQUEST_CODE) { | 242 if (requestCode == FIRST_RUN_EXPERIENCE_REQUEST_CODE) { |
249 if (resultCode == Activity.RESULT_OK) { | 243 if (resultCode == Activity.RESULT_OK) { |
250 // User might have opted out during FRE, so check again. | 244 // User might have opted out during FRE, so check again. |
251 if (mIsCustomTabIntent) { | 245 if (mIsCustomTabIntent) { |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 IntentHandler.ExternalAppId source = | 494 IntentHandler.ExternalAppId source = |
501 IntentHandler.determineExternalIntentSource(getPackageName(), in
tent); | 495 IntentHandler.determineExternalIntentSource(getPackageName(), in
tent); |
502 if (intent.getPackage() == null && source != IntentHandler.ExternalAppId
.CHROME) { | 496 if (intent.getPackage() == null && source != IntentHandler.ExternalAppId
.CHROME) { |
503 int flagsOfInterest = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_AC
TIVITY_NEW_DOCUMENT; | 497 int flagsOfInterest = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_AC
TIVITY_NEW_DOCUMENT; |
504 int maskedFlags = intent.getFlags() & flagsOfInterest; | 498 int maskedFlags = intent.getFlags() & flagsOfInterest; |
505 sIntentFlagsHistogram.record(maskedFlags); | 499 sIntentFlagsHistogram.record(maskedFlags); |
506 } | 500 } |
507 MediaNotificationUma.recordClickSource(intent); | 501 MediaNotificationUma.recordClickSource(intent); |
508 } | 502 } |
509 } | 503 } |
OLD | NEW |