18731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey/* 28731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey * Copyright (C) 2016 The Android Open Source Project 38731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey * 48731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey * Licensed under the Apache License, Version 2.0 (the "License"); 58731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey * you may not use this file except in compliance with the License. 68731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey * You may obtain a copy of the License at 78731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey * 88731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey * http://www.apache.org/licenses/LICENSE-2.0 98731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey * 108731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey * Unless required by applicable law or agreed to in writing, software 118731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey * distributed under the License is distributed on an "AS IS" BASIS, 128731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 138731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey * See the License for the specific language governing permissions and 148731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey * limitations under the License. 158731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey */ 168731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey 178731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkeypackage com.android.documentsui; 188731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey 198731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkeyimport android.content.BroadcastReceiver; 208731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkeyimport android.content.Context; 218731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkeyimport android.content.Intent; 228731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey 238731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey/** 248731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey * Prime {@link RootsCache} when the system is booted. 258731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey */ 268731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkeypublic class BootReceiver extends BroadcastReceiver { 278731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey @Override 288731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey public void onReceive(Context context, Intent intent) { 298731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey // We already spun up our application object before getting here, which 308731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey // kicked off a task to load roots, so this broadcast is finished once 318731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey // that first pass is done. 328731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey DocumentsApplication.getRootsCache(context).setBootCompletedResult(goAsync()); 338731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey } 348731408b11a24e3a92188653548f2c90bf866a32Jeff Sharkey} 35