1 /*
2  * Copyright 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.example.androidx.webkit;
18 
19 import android.os.Bundle;
20 
21 import androidx.appcompat.app.AppCompatActivity;
22 import androidx.webkit.WebViewCompat;
23 import androidx.webkit.WebViewFeature;
24 
25 import org.jspecify.annotations.Nullable;
26 
27 /**
28  * An {@link android.app.Activity} to demonstrate IsMultiProcessEnabled query.
29  */
30 public class MultiProcessEnabledActivity extends AppCompatActivity {
31 
32     @Override
onCreate(@ullable Bundle savedInstanceState)33     protected void onCreate(@Nullable Bundle savedInstanceState) {
34         super.onCreate(savedInstanceState);
35         setContentView(R.layout.activity_is_multi_process_enabled);
36         setTitle(R.string.multi_process_enabled_activity_title);
37         WebkitHelpers.appendWebViewVersionToTitle(this);
38 
39         if (WebViewFeature.isFeatureSupported(WebViewFeature.MULTI_PROCESS)) {
40             if (WebViewCompat.isMultiProcessEnabled()) {
41                 WebkitHelpers.showMessageInActivity(MultiProcessEnabledActivity.this,
42                         R.string.multi_process_enabled);
43             } else {
44                 WebkitHelpers.showMessageInActivity(MultiProcessEnabledActivity.this,
45                         R.string.multi_process_disabled);
46             }
47         } else {
48             WebkitHelpers.showMessageInActivity(MultiProcessEnabledActivity.this,
49                     R.string.multi_process_unavailable);
50         }
51     }
52 }
53