Android STK name Custom

Source: Internet
Author: User



For example, for the Unicom custom version, to implement the SIM card app name dynamically modified to the carrier name:
Background:
1. Since the SAT app is dynamically installed, the SIM app icon in the Launcher menu is the stk1.apk icon.
2. The name of the operator is stored in:
Card 1:telephonyproperties.property_operator_alpha
Card 2:telephonyproperties.property_operator_alpha_2

Custom steps:
1. Obtain the operator name of the card from the Systemproperty
1.1. GB3 Version:
Modified files: Contextimpl.java
The specific changes are as follows:
Import android.os.SystemProperties;
Import com.android.internal.telephony.TelephonyProperties;
@Override
Public charsequence GetText (String packagename, int resid,
ApplicationInfo appInfo) {
ResourceName name = new ResourceName (PackageName, resid);
Charsequence Text = getcachedstring (name);
if (text! = null) {
Add start
if (Packagename.equalsignorecase ("Com.android.stk")) {
LOG.D ("Jby", "packagemanager1,stkpackagename1:" +packagename);
String Tmptext=systemproperties.get (Telephonyproperties.property_operator_alpha);
if (!tmptext.isempty ())
if (!tmptext.equalsignorecase ("COM.ANDROID.STK"))
Text=tmptext;
}else if (packagename.equalsignorecase ("Com.android.stk2")) {
LOG.D ("Jby", "packagemanager1,stkpackagename2:" +packagename);
String Tmptext=systemproperties.get (telephonyproperties.property_operator_alpha_2);
if (!tmptext.isempty ())
if (!tmptext.equalsignorecase ("Com.android.stk2"))
Text=tmptext;
}
LOG.D ("Jby", "text=" +text);
Add End
return text;
}
if (AppInfo = = null) {
try {
AppInfo = Getapplicationinfo (packagename, 0);
} catch (Namenotfoundexception e) {
return null;
}
}
try {
Resources r = getresourcesforapplication (AppInfo);
Text = R.gettext (RESID);
Putcachedstring (name, text);
Add start
if (Packagename.equalsignorecase ("Com.android.stk")) {
LOG.D ("Jby", "packagemanager1,stkpackagename1:" +packagename);
String Tmptext=systemproperties.get (Telephonyproperties.property_operator_alpha);
if (!tmptext.isempty ())
if (!tmptext.equalsignorecase ("COM.ANDROID.STK"))
Text=tmptext;
} else if (Packagename.equalsignorecase ("Com.android.stk2")) {
LOG.D ("Jby", "packagemanager2,stkpackagename2:" +packagename);
String Tmptext=systemproperties.get (telephonyproperties.property_operator_alpha_2);
if (!tmptext.isempty ())
if (!tmptext.equalsignorecase ("Com.android.stk2"))
Text=tmptext;
}
LOG.D ("Jby", "text=" +text);
Add End
return text;
} catch (Namenotfoundexception e) {
LOG.W ("Packagemanager", "Failure Retrieving resources for"
+ Appinfo.packagename);
} catch (RuntimeException e) {
If An exception is thrown, fall through to return
Default icon.
LOG.W ("Packagemanager", "Failure retrieving text 0x"
+ integer.tohexstring (RESID) + "in package"
+ PackageName, E);
}
return null;
}

1.2, the same, JB2 and JB2 later version:
Modified files: Applicationpackagemanager.java
Specific changes: Refer to the above GB3 version modification, basically the same.


2. Use the operator name obtained in step 1 to dynamically modify the package's corresponding app name (application names)
Modified files: Pagedviewicon.java
KK Previous version of the file path: alps\packages\apps\launcher2\src\com\android\launcher2\
KK later version of the file path: alps\packages\apps\launcher3\src\com\android\launcher3\

2.1, GB3, GB5 version:
The SetText in the Applyfromapplicationinfo () method is filtered by PackageName to set the desired display name.
For example: PackageName = "Com.android.stk1", expected to display the name "My Name"
if (PackageName equals Info.componentName.mPackage)
{
SetText ("My Name")
}
Else
{
SetText (Info.title);
}


2.2, JB2 and JB2 later versions
Two STK applications are shared with a packagename, so they cannot be distinguished by the package name, and must be distinguished by the class name. For example, inserting a SIM card slot 2 or Usim application is by starting "Stklauncheractivityⅱ".
Therefore, the SetText in the Applyfromapplicationinfo () method is filtered by Targetclassname to set the desired display name.
For example: Targetclassname = "Stklauncheractivityⅱ", expected to display the name "My Name"
if (Targetclassname equals Info.componentName.mClass)
{
SetText ("My Name")
}
Else
{
SetText (Info.title);
}



To modify the application's shortcut name:
Modified files: Iconcache.java
KK Previous path: Packages\apps\launcher2\src\com\android\launcher2\iconcache.java
KK Future Path: Packages\apps\launcher3\src\com\android\launcher3\iconcache.java
Specific changes:
Assign the Cachelocked () method to Entry.title by assigning the name to be displayed in a special judgment.
In the same way, the above two situations should be distinguished.

Android STK name Custom

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.