Skip to content

Commit

Permalink
Settings: Add Device codename to Firmware version window
Browse files Browse the repository at this point in the history
Change-Id: I61fd4d77375df019da94ed7fca71da157dd0f415
Signed-off-by: Pranav Vashi <[email protected]>
  • Loading branch information
ganeshi4u authored and nattolecats committed Dec 26, 2024
1 parent ca94288 commit c9f9e92
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
8 changes: 8 additions & 0 deletions res/xml/firmware_version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@

<PreferenceCategory />

<!-- Device name -->
<Preference
android:key="about_device_name"
android:title="@string/bluetooth_device_name"
android:summary="@string/summary_placeholder"
settings:enableCopying="true"
settings:controller="com.android.settings.deviceinfo.firmwareversion.AboutDeviceNamePreferenceController"/>

<!-- Android version -->
<Preference
android:key="os_firmware_version"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright (C) 2019-2023 crDroid Android 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.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.Log;

import androidx.preference.Preference;

import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;

public class AboutDeviceNamePreferenceController extends BasePreferenceController {

private static final String TAG = "AboutDeviceNameCtrl";

private static final String KEY_BRAND_NAME_PROP = "ro.product.manufacturer";
private static final String KEY_DEVICE_NAME_PROP = "ro.product.device";

public AboutDeviceNamePreferenceController(Context context, String key) {
super(context, key);
}

@Override
public int getAvailabilityStatus() {
return AVAILABLE;
}

@Override
public CharSequence getSummary() {
String deviceBrand = SystemProperties.get(KEY_BRAND_NAME_PROP,
mContext.getString(R.string.device_info_default));
String deviceCodename = SystemProperties.get(KEY_DEVICE_NAME_PROP,
mContext.getString(R.string.device_info_default));
String deviceModel = Build.MODEL;
return deviceBrand + " " + deviceModel + " | " + deviceCodename;
}
}

0 comments on commit c9f9e92

Please sign in to comment.