Files
packages_apps_Settings/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceController.java
tmfang 1f37d190c0 Slices feature supports firmware version.
- Migrate FirmwareVersionPreferenceController to BasePreferenceController class.
- Because slices feature needs an unique uri,
  we should avoid same firmware key in my_device_info.xml and device_info_settings.xml.
- Modify test case for new firmware version controller.

Test: slice uri > content://android.settings.slices/intent/my_device_firmware_version
Test: make RunSettingsRoboTests -j
      atest UniquePreferenceTest SettingsGatewayTest
Change-Id: If516bbdb3ddb823db9909123ef694a2beaf5dc66
2018-04-26 15:22:01 -07:00

60 lines
1.6 KiB
Java

/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.deviceinfo.firmwareversion;
import android.app.Fragment;
import android.content.Context;
import android.os.Build;
import android.text.TextUtils;
import com.android.settings.core.BasePreferenceController;
import androidx.preference.Preference;
public class FirmwareVersionPreferenceController extends BasePreferenceController {
private Fragment mFragment;
public FirmwareVersionPreferenceController(Context context, String key) {
super(context, key);
}
public void setHost(Fragment fragment) {
mFragment = fragment;
}
@Override
public int getAvailabilityStatus() {
return AVAILABLE;
}
@Override
public CharSequence getSummary() {
return Build.VERSION.RELEASE;
}
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
if (!TextUtils.equals(preference.getKey(), mPreferenceKey)) {
return false;
}
FirmwareVersionDialogFragment.show(mFragment);
return true;
}
}