• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package android.localemanager.cts.installer;
17 
18 import static android.localemanager.cts.util.LocaleConstants.INSTALLER_APP_BROADCAST_INFO_PROVIDER_ACTION;
19 import static android.localemanager.cts.util.LocaleUtils.constructResultIntent;
20 
21 import android.content.BroadcastReceiver;
22 import android.content.Context;
23 import android.content.Intent;
24 
25 /**
26  * A broadcast receiver that listens to
27  * {@link android.content.Intent#ACTION_APPLICATION_LOCALE_CHANGED}
28  * when it is the installer of the app whose locale has changed.
29  */
30 public class InstallerBroadcastReceiver extends BroadcastReceiver{
31 
32     @Override
onReceive(Context context, Intent intent)33     public void onReceive(Context context, Intent intent) {
34         // Upon successful receipt of broadcast, send back the response to the test which
35         // invoked the change, so that it can verify correctness.
36         if (Intent.ACTION_APPLICATION_LOCALE_CHANGED.equals(intent.getAction())) {
37             context.sendBroadcast(constructResultIntent(
38                     INSTALLER_APP_BROADCAST_INFO_PROVIDER_ACTION, intent));
39         }
40     }
41 }
42