sdk: Remove unused deviceinfo prefs

Change-Id: I0d9e5aa52305d76ebe0202228a238efa9ef1e32a
This commit is contained in:
LuK1337
2022-08-30 15:56:36 +02:00
parent 4ddfcce49e
commit c2c42fe8d1
5 changed files with 0 additions and 280 deletions

View File

@@ -1,36 +0,0 @@
/*
* Copyright (C) 2018 The LineageOS 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 org.lineageos.internal.preference.deviceinfo;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;
public class LineageAPIVersionTextView extends TextView {
private static final String TAG = "LineageAPIVersionTextView";
public LineageAPIVersionTextView(Context context, AttributeSet attrs) {
super(context, attrs);
final int sdk = lineageos.os.Build.LINEAGE_VERSION.SDK_INT;
StringBuilder builder = new StringBuilder();
builder.append(lineageos.os.Build.getNameForSDKInt(sdk))
.append(" (" + sdk + ")");
setText(builder.toString());
}
}

View File

@@ -1,37 +0,0 @@
/*
* Copyright (C) 2018 The LineageOS 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 org.lineageos.internal.preference.deviceinfo;
import android.content.Context;
import android.os.SystemProperties;
import android.util.AttributeSet;
import android.widget.TextView;
import org.lineageos.platform.internal.R;
public class LineageBuildDateTextView extends TextView {
private static final String TAG = "LineageAPIVersionTextView";
private static final String KEY_BUILD_DATE_PROP = "ro.build.date";
public LineageBuildDateTextView(Context context, AttributeSet attrs) {
super(context, attrs);
setText(SystemProperties.get(KEY_BUILD_DATE_PROP,
getContext().getResources().getString(R.string.unknown)));
}
}

View File

@@ -1,70 +0,0 @@
/*
* Copyright (C) 2017 The LineageOS 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 org.lineageos.internal.preference.deviceinfo;
import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.util.Log;
import androidx.preference.Preference;
import lineageos.preference.SelfRemovingPreference;
import org.lineageos.platform.internal.R;
public class LineageUpdatesPreference extends SelfRemovingPreference
implements Preference.OnPreferenceClickListener {
private static final String TAG = "LineageUpdatesPreference";
private static final String UPDATER_PACKAGE_NAME = "org.lineageos.updater";
private static final String UPDATER_ACTIVITY_CLASS =
UPDATER_PACKAGE_NAME + ".UpdatesActivity";
public LineageUpdatesPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public LineageUpdatesPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
public LineageUpdatesPreference(Context context) {
super(context);
}
@Override
public void onAttached() {
super.onAttached();
setOnPreferenceClickListener(this);
setTitle(R.string.lineage_updates);
}
@Override
public boolean onPreferenceClick(Preference preference) {
final Intent intent = new Intent(Intent.ACTION_MAIN)
.setClassName(UPDATER_PACKAGE_NAME, UPDATER_ACTIVITY_CLASS);
try {
getContext().startActivity(intent);
} catch (Exception e) {
Log.e(TAG, "Unable to start activity " + intent.toString());
}
return true; // handled
}
}

View File

@@ -1,70 +0,0 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2017-2018 The LineageOS 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 org.lineageos.internal.preference.deviceinfo;
import android.content.Context;
import android.os.SystemProperties;
import android.text.format.DateFormat;
import android.util.AttributeSet;
import android.widget.TextView;
import org.lineageos.platform.internal.R;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class LineageVendorSecurityPatchTextView extends TextView {
private static final String TAG = "LineageVendorSecurityPatchTextView";
private static final String KEY_AOSP_VENDOR_SECURITY_PATCH =
"ro.vendor.build.security_patch";
private static final String KEY_LINEAGE_VENDOR_SECURITY_PATCH =
"ro.lineage.build.vendor_security_patch";
public LineageVendorSecurityPatchTextView(Context context, AttributeSet attrs) {
super(context, attrs);
setText(getVendorSecurityPatchLevel());
}
private String getVendorSecurityPatchLevel() {
String patchLevel = SystemProperties.get(KEY_AOSP_VENDOR_SECURITY_PATCH);
if (patchLevel.isEmpty()) {
patchLevel = SystemProperties.get(KEY_LINEAGE_VENDOR_SECURITY_PATCH);
}
if (!patchLevel.isEmpty()) {
try {
SimpleDateFormat template = new SimpleDateFormat("yyyy-MM-dd");
Date patchLevelDate = template.parse(patchLevel);
String format = DateFormat.getBestDateTimePattern(Locale.getDefault(), "dMMMMyyyy");
patchLevel = DateFormat.format(format, patchLevelDate).toString();
} catch (ParseException e) {
// parsing failed, use raw string
}
} else {
patchLevel = getContext().getResources().getString(R.string.unknown);
}
return patchLevel;
}
}

View File

@@ -1,67 +0,0 @@
/*
* Copyright (C) 2018 The LineageOS 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 org.lineageos.internal.preference.deviceinfo;
import android.content.Context;
import android.content.Intent;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import org.lineageos.platform.internal.R;
public class LineageVersionTextView extends TextView implements View.OnClickListener {
private static final String TAG = "LineageVersionTextView";
private static final String KEY_LINEAGE_VERSION_PROP = "ro.lineage.version";
private static final String PLATLOGO_PACKAGE_NAME = "org.lineageos.lineageparts";
private static final String PLATLOGO_ACTIVITY_CLASS =
PLATLOGO_PACKAGE_NAME + ".logo.PlatLogoActivity";
private long[] mHits = new long[3];
public LineageVersionTextView(Context context, AttributeSet attrs) {
super(context, attrs);
setText(SystemProperties.get(KEY_LINEAGE_VERSION_PROP,
getContext().getResources().getString(R.string.unknown)));
setOnClickListener(this);
}
@Override
public void onClick(View v) {
System.arraycopy(mHits, 1, mHits, 0, mHits.length - 1);
mHits[mHits.length - 1] = SystemClock.uptimeMillis();
if (mHits[0] >= (SystemClock.uptimeMillis() - 500)) {
launchLogoActivity();
}
}
private void launchLogoActivity() {
final Intent intent = new Intent(Intent.ACTION_MAIN)
.setClassName(PLATLOGO_PACKAGE_NAME, PLATLOGO_ACTIVITY_CLASS);
try {
getContext().startActivity(intent);
} catch (Exception e) {
Log.e(TAG, "Unable to start activity " + intent.toString());
}
}
}