• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2013 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.accounts;
17 
18 
19 import static android.app.admin.DevicePolicyResources.Strings.Core.CANT_ADD_ACCOUNT_MESSAGE;
20 
21 import android.app.Activity;
22 import android.app.admin.DevicePolicyManager;
23 import android.os.Bundle;
24 import android.view.View;
25 import android.widget.TextView;
26 
27 import com.android.internal.R;
28 
29 /**
30  * @hide
31  * Just shows an error message about the account restrictions for the limited user.
32  */
33 public class CantAddAccountActivity extends Activity {
34     public static final String EXTRA_ERROR_CODE = "android.accounts.extra.ERROR_CODE";
35 
36     @Override
onCreate(Bundle savedInstanceState)37     public void onCreate(Bundle savedInstanceState) {
38         super.onCreate(savedInstanceState);
39         setContentView(R.layout.app_not_authorized);
40 
41         TextView view = findViewById(R.id.description);
42         String text = getSystemService(DevicePolicyManager.class).getResources().getString(
43                 CANT_ADD_ACCOUNT_MESSAGE,
44                 () -> getString(R.string.error_message_change_not_allowed));
45         view.setText(text);
46     }
47 
onCancelButtonClicked(View view)48     public void onCancelButtonClicked(View view) {
49         onBackPressed();
50     }
51 }
52