1 /* <lambda>null2 * Copyright (C) 2024 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.safetyregulatoryinfo 18 19 import android.os.Bundle 20 import android.webkit.WebView 21 import androidx.activity.ComponentActivity 22 import androidx.activity.enableEdgeToEdge 23 import androidx.core.view.ViewCompat 24 import androidx.core.view.WindowInsetsCompat 25 26 class SafetyAndRegulatoryInfoActivity : ComponentActivity() { 27 override fun onCreate(savedInstanceState: Bundle?) { 28 super.onCreate(savedInstanceState) 29 30 enableEdgeToEdge() 31 setContentView(R.layout.safety_and_regulatory_info) 32 33 ViewCompat.setOnApplyWindowInsetsListener(requireViewById(R.id.main)) { v, insets -> 34 val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()) 35 v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) 36 insets 37 } 38 39 val webView: WebView = requireViewById(R.id.webview) 40 webView.settings.apply { 41 savePassword = false 42 saveFormData = false 43 blockNetworkLoads = true 44 45 // Javascript is purposely disabled, so that nothing can be automatically run. 46 javaScriptEnabled = false 47 defaultTextEncodingName = "utf-8" 48 } 49 webView.loadUrl("file:///android_res/raw/regulatory_content.html") 50 } 51 } 52