• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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 
17 package com.android.settings.development;
18 
19 import android.app.Activity;
20 import android.content.Intent;
21 import android.os.Bundle;
22 import android.text.TextUtils;
23 import android.view.View;
24 import android.widget.Button;
25 import android.widget.TextView;
26 
27 import com.android.settings.R;
28 
29 /** Activity shows terms of service for a given DSU package */
30 public class DSUTermsOfServiceActivity extends Activity {
31     public static final String KEY_TOS = "KEY_TOS";
32 
installDSU(Intent intent)33     private void installDSU(Intent intent) {
34         intent.setClassName("com.android.dynsystem", "com.android.dynsystem.VerificationActivity");
35         startActivity(intent);
36         finish();
37     }
38 
39     @Override
onCreate(Bundle bundle)40     protected void onCreate(Bundle bundle) {
41         super.onCreate(bundle);
42         setContentView(R.layout.dsu_terms_of_service);
43         TextView tv = findViewById(R.id.tos_content);
44         Intent intent = getIntent();
45         if (!intent.hasExtra(KEY_TOS)) {
46             finish();
47         }
48         String tos = intent.getStringExtra(KEY_TOS);
49         if (TextUtils.isEmpty(tos)) {
50             installDSU(intent);
51         } else {
52             tv.setText(tos);
53             Button accept = findViewById(R.id.accept);
54             accept.setOnClickListener(
55                     new Button.OnClickListener() {
56                         @Override
57                         public void onClick(View v) {
58                             installDSU(intent);
59                         }
60                     });
61         }
62     }
63 }
64