OSDN Git Service

6787089e267373fd3b99169ce884754f9237b2d4
[android-x86/packages-apps-Settings.git] / src / com / android / settings / dashboard / SupportDashboardActivity.java
1 /*
2  * Copyright (C) 2017 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 com.android.settings.dashboard;
17
18 import android.app.Activity;
19 import android.content.Intent;
20 import android.os.Bundle;
21 import com.android.settings.Settings.LegacySupportActivity;
22 import com.android.settings.overlay.FeatureFactory;
23 import com.android.settings.overlay.SupportFeatureProvider;
24
25 /**
26  * Trampoline activity that decides which version of support should be shown to the user.
27  */
28 public class SupportDashboardActivity extends Activity {
29
30     @Override
31     protected void onCreate(Bundle savedInstanceState) {
32         super.onCreate(savedInstanceState);
33         SupportFeatureProvider supportFeatureProvider = FeatureFactory.getFactory(this)
34                 .getSupportFeatureProvider(this);
35
36         // try to launch support v2 if we have the feature provider
37         if (supportFeatureProvider != null && supportFeatureProvider.isSupportV2Enabled()) {
38             supportFeatureProvider.startSupportV2(this);
39         } else {
40             startActivity(new Intent(this, LegacySupportActivity.class));
41         }
42         finish();
43     }
44 }