auto import from //branches/cupcake_rel/...@141571
This commit is contained in:
@@ -373,7 +373,9 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<activity android:name="ActivityPicker" android:label="@string/activity_picker_label">
|
<activity android:name="ActivityPicker"
|
||||||
|
android:label="@string/activity_picker_label"
|
||||||
|
android:theme="@android:style/Theme.Light">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.PICK_ACTIVITY" />
|
<action android:name="android.intent.action.PICK_ACTIVITY" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
@@ -474,7 +476,9 @@
|
|||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<!-- Standard picker for widgets -->
|
<!-- Standard picker for widgets -->
|
||||||
<activity android:name="AppWidgetPickActivity" android:label="@string/widget_picker_title">
|
<activity android:name="AppWidgetPickActivity"
|
||||||
|
android:label="@string/widget_picker_title"
|
||||||
|
android:theme="@android:style/Theme.Light">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.appwidget.action.APPWIDGET_PICK" />
|
<action android:name="android.appwidget.action.APPWIDGET_PICK" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
65
res/layout/apn_preference_layout.xml
Normal file
65
res/layout/apn_preference_layout.xml
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+android:id/text_layout"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="16sp"
|
||||||
|
android:layout_marginRight="6sp"
|
||||||
|
android:layout_marginTop="6sp"
|
||||||
|
android:layout_marginBottom="6sp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:focusable="true"
|
||||||
|
android:background="@android:drawable/menuitem_background">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+android:id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:focusable="true"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+android:id/summary"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@android:id/title"
|
||||||
|
android:layout_alignLeft="@android:id/title"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:maxLines="2" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+android:id/apn_radiobutton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="4dip"
|
||||||
|
android:layout_marginRight="4dip"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:clickable="true" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
@@ -265,6 +265,24 @@
|
|||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<!-- Other controls section -->
|
||||||
|
<TextView
|
||||||
|
style="?android:attr/listSeparatorTextViewStyle"
|
||||||
|
android:text="@string/controls_label" />
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical">
|
||||||
|
<Button android:id="@+id/force_stop_button"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_width="150dip"
|
||||||
|
android:text="@string/force_stop"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<!-- Permissions section -->
|
<!-- Permissions section -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/permissions_section"
|
android:id="@+id/permissions_section"
|
||||||
@@ -288,24 +306,6 @@
|
|||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:orientation="vertical"/>
|
android:orientation="vertical"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- Prefered activities section -->
|
|
||||||
<TextView
|
|
||||||
style="?android:attr/listSeparatorTextViewStyle"
|
|
||||||
android:text="@string/controls_label" />
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical">
|
|
||||||
<Button android:id="@+id/force_stop_button"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_width="150dip"
|
|
||||||
android:text="@string/force_stop"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
</RelativeLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
@@ -412,7 +412,7 @@
|
|||||||
<string name="device_info_not_available">"該当なし"</string>
|
<string name="device_info_not_available">"該当なし"</string>
|
||||||
<string name="device_status_activity_title">"端末の状態"</string>
|
<string name="device_status_activity_title">"端末の状態"</string>
|
||||||
<string name="device_status">"端末の状態"</string>
|
<string name="device_status">"端末の状態"</string>
|
||||||
<string name="device_status_summary">"電話番号、端末識別番号、電波状態など"</string>
|
<string name="device_status_summary">"電池残量、電話番号、ネットワークなど"</string>
|
||||||
<string name="storage_settings_title">"SDカード & 端末容量"</string>
|
<string name="storage_settings_title">"SDカード & 端末容量"</string>
|
||||||
<string name="storage_settings_summary">"SDカードの取り外し、空き容量の表示"</string>
|
<string name="storage_settings_summary">"SDカードの取り外し、空き容量の表示"</string>
|
||||||
<string name="status_number">"電話番号"</string>
|
<string name="status_number">"電話番号"</string>
|
||||||
@@ -552,7 +552,7 @@
|
|||||||
<string name="auto_launch_label">"いつもこのアプリケーションを選択する操作"</string>
|
<string name="auto_launch_label">"いつもこのアプリケーションを選択する操作"</string>
|
||||||
<string name="permissions_label">"許可"</string>
|
<string name="permissions_label">"許可"</string>
|
||||||
<string name="cache_header_label">"キャッシュ"</string>
|
<string name="cache_header_label">"キャッシュ"</string>
|
||||||
<string name="clear_cache_btn_text">"キャッシュをクリア"</string>
|
<string name="clear_cache_btn_text">"キャッシュを消去"</string>
|
||||||
<string name="cache_size_label">"キャッシュ"</string>
|
<string name="cache_size_label">"キャッシュ"</string>
|
||||||
<string name="controls_label">"コントロール"</string>
|
<string name="controls_label">"コントロール"</string>
|
||||||
<string name="force_stop">"強制停止"</string>
|
<string name="force_stop">"強制停止"</string>
|
||||||
@@ -601,6 +601,8 @@
|
|||||||
<string name="auto_punctuate_summary">"英語: Spaceキー2回でピリオド(.)を挿入"</string>
|
<string name="auto_punctuate_summary">"英語: Spaceキー2回でピリオド(.)を挿入"</string>
|
||||||
<string name="show_password">"パスワードを表示"</string>
|
<string name="show_password">"パスワードを表示"</string>
|
||||||
<string name="show_password_summary">"入力時にパスワードを表示する"</string>
|
<string name="show_password_summary">"入力時にパスワードを表示する"</string>
|
||||||
|
<!-- no translation found for ime_security_warning (3458652708716006477) -->
|
||||||
|
<skip />
|
||||||
<string name="user_dict_settings_titlebar">"ユーザー辞書"</string>
|
<string name="user_dict_settings_titlebar">"ユーザー辞書"</string>
|
||||||
<string name="user_dict_settings_title">"ユーザー辞書"</string>
|
<string name="user_dict_settings_title">"ユーザー辞書"</string>
|
||||||
<string name="user_dict_settings_summary">"ユーザー辞書への語句の追加と削除"</string>
|
<string name="user_dict_settings_summary">"ユーザー辞書への語句の追加と削除"</string>
|
||||||
|
@@ -751,8 +751,10 @@
|
|||||||
<string name="sound_and_display_settings_summary">Set ringtones, notifications, screen brightness</string>
|
<string name="sound_and_display_settings_summary">Set ringtones, notifications, screen brightness</string>
|
||||||
<!-- Sound settings screen, setting option name checkbox -->
|
<!-- Sound settings screen, setting option name checkbox -->
|
||||||
<string name="silent_mode_title">Silent mode</string>
|
<string name="silent_mode_title">Silent mode</string>
|
||||||
<!-- Sound settings screen, setting option summary text -->
|
<!-- Sound settings screen, setting option summary text when going into silent mode. Media and alarms sounds WILL NOT be silenced in silent mode. -->
|
||||||
<string name="silent_mode_summary">All sounds except media & alarms are silenced</string>
|
<string name="silent_mode_summary">All sounds except media & alarms are silenced</string>
|
||||||
|
<!-- Sound settings screen, setting option summary text when going into silent mode. Media WILL NOT be silenced in silent mode, but alarms WILL be silenced. -->
|
||||||
|
<string name="silent_mode_incl_alarm_summary">All sounds except media are silenced</string>
|
||||||
<!-- Sound settings screen, setting option name to pick ringtone (a list dialog comes up)-->
|
<!-- Sound settings screen, setting option name to pick ringtone (a list dialog comes up)-->
|
||||||
<string name="ringtone_title">Phone ringtone</string>
|
<string name="ringtone_title">Phone ringtone</string>
|
||||||
<!-- Sound settings screen, setting option summary text -->
|
<!-- Sound settings screen, setting option summary text -->
|
||||||
|
151
src/com/android/settings/ApnPreference.java
Normal file
151
src/com/android/settings/ApnPreference.java
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 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;
|
||||||
|
|
||||||
|
import android.content.ContentUris;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.preference.Preference;
|
||||||
|
import android.provider.Telephony;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
|
public class ApnPreference extends Preference implements
|
||||||
|
CompoundButton.OnCheckedChangeListener, OnClickListener {
|
||||||
|
final static String TAG = "ApnPreference";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @param attrs
|
||||||
|
* @param defStyle
|
||||||
|
*/
|
||||||
|
public ApnPreference(Context context, AttributeSet attrs, int defStyle) {
|
||||||
|
super(context, attrs, defStyle);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @param attrs
|
||||||
|
*/
|
||||||
|
public ApnPreference(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
public ApnPreference(Context context) {
|
||||||
|
super(context);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String mSelectedKey = null;
|
||||||
|
private static CompoundButton mCurrentChecked = null;
|
||||||
|
private boolean mProtectFromCheckedChange = false;
|
||||||
|
private boolean mSelectable = true;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(View convertView, ViewGroup parent) {
|
||||||
|
View view = super.getView(convertView, parent);
|
||||||
|
|
||||||
|
View widget = view.findViewById(R.id.apn_radiobutton);
|
||||||
|
if ((widget != null) && widget instanceof RadioButton) {
|
||||||
|
RadioButton rb = (RadioButton) widget;
|
||||||
|
if (mSelectable) {
|
||||||
|
rb.setOnCheckedChangeListener(this);
|
||||||
|
|
||||||
|
boolean isChecked = getKey().equals(mSelectedKey);
|
||||||
|
if (isChecked) {
|
||||||
|
mCurrentChecked = rb;
|
||||||
|
mSelectedKey = getKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
mProtectFromCheckedChange = true;
|
||||||
|
rb.setChecked(isChecked);
|
||||||
|
mProtectFromCheckedChange = false;
|
||||||
|
} else {
|
||||||
|
rb.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
View textLayout = view.findViewById(R.id.text_layout);
|
||||||
|
if ((textLayout != null) && textLayout instanceof RelativeLayout) {
|
||||||
|
textLayout.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
setLayoutResource(R.layout.apn_preference_layout);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isChecked() {
|
||||||
|
return getKey().equals(mSelectedKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChecked(boolean checked) {
|
||||||
|
mSelectedKey = getKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
Log.i(TAG, "ID: " + getKey() + " :" + isChecked);
|
||||||
|
if (mProtectFromCheckedChange) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isChecked) {
|
||||||
|
if (mCurrentChecked != null) {
|
||||||
|
mCurrentChecked.setChecked(false);
|
||||||
|
}
|
||||||
|
mCurrentChecked = buttonView;
|
||||||
|
mSelectedKey = getKey();
|
||||||
|
callChangeListener(mSelectedKey);
|
||||||
|
} else {
|
||||||
|
mCurrentChecked = null;
|
||||||
|
mSelectedKey = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick(android.view.View v) {
|
||||||
|
if ((v != null) && (R.id.text_layout == v.getId())) {
|
||||||
|
Context context = getContext();
|
||||||
|
if (context != null) {
|
||||||
|
int pos = Integer.parseInt(getKey());
|
||||||
|
Uri url = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, pos);
|
||||||
|
context.startActivity(new Intent(Intent.ACTION_EDIT, url));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectable(boolean selectable) {
|
||||||
|
mSelectable = selectable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getSelectable() {
|
||||||
|
return mSelectable;
|
||||||
|
}
|
||||||
|
}
|
@@ -18,10 +18,13 @@ package com.android.settings;
|
|||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.ContentUris;
|
import android.content.ContentUris;
|
||||||
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -34,20 +37,33 @@ import android.preference.PreferenceActivity;
|
|||||||
import android.preference.PreferenceGroup;
|
import android.preference.PreferenceGroup;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.provider.Telephony;
|
import android.provider.Telephony;
|
||||||
import android.text.TextUtils;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class ApnSettings extends PreferenceActivity {
|
import com.android.internal.telephony.Phone;
|
||||||
|
import com.android.internal.telephony.TelephonyIntents;
|
||||||
|
import com.android.internal.telephony.TelephonyProperties;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class ApnSettings extends PreferenceActivity implements
|
||||||
|
Preference.OnPreferenceChangeListener {
|
||||||
|
static final String TAG = "ApnSettings";
|
||||||
|
|
||||||
public static final String EXTRA_POSITION = "position";
|
public static final String EXTRA_POSITION = "position";
|
||||||
public static final String RESTORE_CARRIERS_URI =
|
public static final String RESTORE_CARRIERS_URI =
|
||||||
"content://telephony/carriers/restore";
|
"content://telephony/carriers/restore";
|
||||||
|
public static final String PREFERRED_APN_URI =
|
||||||
|
"content://telephony/carriers/preferapn";
|
||||||
|
|
||||||
|
public static final String APN_ID = "apn_id";
|
||||||
|
|
||||||
private static final int ID_INDEX = 0;
|
private static final int ID_INDEX = 0;
|
||||||
private static final int NAME_INDEX = 1;
|
private static final int NAME_INDEX = 1;
|
||||||
private static final int APN_INDEX = 2;
|
private static final int APN_INDEX = 2;
|
||||||
|
private static final int TYPES_INDEX = 3;
|
||||||
|
|
||||||
private static final int MENU_NEW = Menu.FIRST;
|
private static final int MENU_NEW = Menu.FIRST;
|
||||||
private static final int MENU_RESTORE = Menu.FIRST + 1;
|
private static final int MENU_RESTORE = Menu.FIRST + 1;
|
||||||
@@ -58,25 +74,62 @@ public class ApnSettings extends PreferenceActivity {
|
|||||||
private static final int DIALOG_RESTORE_DEFAULTAPN = 1001;
|
private static final int DIALOG_RESTORE_DEFAULTAPN = 1001;
|
||||||
|
|
||||||
private static final Uri DEFAULTAPN_URI = Uri.parse(RESTORE_CARRIERS_URI);
|
private static final Uri DEFAULTAPN_URI = Uri.parse(RESTORE_CARRIERS_URI);
|
||||||
|
private static final Uri PREFERAPN_URI = Uri.parse(PREFERRED_APN_URI);
|
||||||
|
|
||||||
private static boolean mRestoreDefaultApnMode;
|
private static boolean mRestoreDefaultApnMode;
|
||||||
|
|
||||||
private RestoreApnUiHandler mRestoreApnUiHandler;
|
private RestoreApnUiHandler mRestoreApnUiHandler;
|
||||||
private RestoreApnProcessHandler mRestoreApnProcessHandler;
|
private RestoreApnProcessHandler mRestoreApnProcessHandler;
|
||||||
|
|
||||||
private Cursor mCursor;
|
private String mSelectedKey;
|
||||||
|
|
||||||
|
private IntentFilter mMobileStateFilter;
|
||||||
|
|
||||||
|
private final BroadcastReceiver mMobileStateReceiver = new BroadcastReceiver() {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
if (intent.getAction().equals(
|
||||||
|
TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED)) {
|
||||||
|
Phone.DataState state = getMobileDataState(intent);
|
||||||
|
switch (state) {
|
||||||
|
case CONNECTED:
|
||||||
|
if (!mRestoreDefaultApnMode) {
|
||||||
|
fillList();
|
||||||
|
} else {
|
||||||
|
showDialog(DIALOG_RESTORE_DEFAULTAPN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private static Phone.DataState getMobileDataState(Intent intent) {
|
||||||
|
String str = intent.getStringExtra(Phone.STATE_KEY);
|
||||||
|
if (str != null) {
|
||||||
|
return Enum.valueOf(Phone.DataState.class, str);
|
||||||
|
} else {
|
||||||
|
return Phone.DataState.DISCONNECTED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle icicle) {
|
protected void onCreate(Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
|
|
||||||
addPreferencesFromResource(R.xml.apn_settings);
|
addPreferencesFromResource(R.xml.apn_settings);
|
||||||
|
getListView().setItemsCanFocus(true);
|
||||||
|
|
||||||
|
mMobileStateFilter = new IntentFilter(
|
||||||
|
TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
registerReceiver(mMobileStateReceiver, mMobileStateFilter);
|
||||||
|
|
||||||
if (!mRestoreDefaultApnMode) {
|
if (!mRestoreDefaultApnMode) {
|
||||||
fillList();
|
fillList();
|
||||||
} else {
|
} else {
|
||||||
@@ -84,29 +137,59 @@ public class ApnSettings extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
|
||||||
|
unregisterReceiver(mMobileStateReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
private void fillList() {
|
private void fillList() {
|
||||||
mCursor = managedQuery(Telephony.Carriers.CONTENT_URI, new String[] {
|
String where = "numeric=\""
|
||||||
"_id", "name", "apn"}, null, Telephony.Carriers.DEFAULT_SORT_ORDER);
|
+ android.os.SystemProperties.get(TelephonyProperties.PROPERTY_SIM_OPERATOR_NUMERIC, "")
|
||||||
|
+ "\"";
|
||||||
|
|
||||||
|
Cursor cursor = managedQuery(Telephony.Carriers.CONTENT_URI, new String[] {
|
||||||
|
"_id", "name", "apn", "type"}, where,
|
||||||
|
Telephony.Carriers.DEFAULT_SORT_ORDER);
|
||||||
|
|
||||||
PreferenceGroup apnList = (PreferenceGroup) findPreference("apn_list");
|
PreferenceGroup apnList = (PreferenceGroup) findPreference("apn_list");
|
||||||
apnList.removeAll();
|
apnList.removeAll();
|
||||||
|
|
||||||
mCursor.moveToFirst();
|
ArrayList<Preference> mmsApnList = new ArrayList<Preference>();
|
||||||
while (!mCursor.isAfterLast()) {
|
|
||||||
String name = mCursor.getString(NAME_INDEX);
|
|
||||||
String apn = mCursor.getString(APN_INDEX);
|
|
||||||
|
|
||||||
if (name != null && apn != null && TextUtils.getTrimmedLength(name) > 0
|
mSelectedKey = getSelectedApnKey();
|
||||||
&& TextUtils.getTrimmedLength(apn) > 0) {
|
cursor.moveToFirst();
|
||||||
Preference pref = new Preference((Context) this);
|
while (!cursor.isAfterLast()) {
|
||||||
pref.setKey(mCursor.getString(ID_INDEX));
|
String name = cursor.getString(NAME_INDEX);
|
||||||
|
String apn = cursor.getString(APN_INDEX);
|
||||||
|
String key = cursor.getString(ID_INDEX);
|
||||||
|
String type = cursor.getString(TYPES_INDEX);
|
||||||
|
|
||||||
|
ApnPreference pref = new ApnPreference(this);
|
||||||
|
|
||||||
|
pref.setKey(key);
|
||||||
pref.setTitle(name);
|
pref.setTitle(name);
|
||||||
pref.setSummary(apn);
|
pref.setSummary(apn);
|
||||||
pref.setPersistent(false);
|
pref.setPersistent(false);
|
||||||
apnList.addPreference(pref);
|
pref.setOnPreferenceChangeListener(this);
|
||||||
}
|
|
||||||
|
|
||||||
mCursor.moveToNext();
|
boolean selectable = ((type == null) || !type.equals("mms"));
|
||||||
|
pref.setSelectable(selectable);
|
||||||
|
if (selectable) {
|
||||||
|
if ((mSelectedKey != null) && mSelectedKey.equals(key)) {
|
||||||
|
pref.setChecked(true);
|
||||||
|
}
|
||||||
|
apnList.addPreference(pref);
|
||||||
|
} else {
|
||||||
|
mmsApnList.add(pref);
|
||||||
|
}
|
||||||
|
cursor.moveToNext();
|
||||||
|
}
|
||||||
|
cursor.close();
|
||||||
|
|
||||||
|
for (Preference preference : mmsApnList) {
|
||||||
|
apnList.addPreference(preference);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,6 +231,39 @@ public class ApnSettings extends PreferenceActivity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
|
Log.d(TAG, "onPreferenceChange(): Preference - " + preference
|
||||||
|
+ ", newValue - " + newValue + ", newValue type - "
|
||||||
|
+ newValue.getClass());
|
||||||
|
if (newValue instanceof String) {
|
||||||
|
setSelectedApnKey((String) newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setSelectedApnKey(String key) {
|
||||||
|
mSelectedKey = key;
|
||||||
|
ContentResolver resolver = getContentResolver();
|
||||||
|
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
values.put(APN_ID, mSelectedKey);
|
||||||
|
resolver.update(PREFERAPN_URI, values, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getSelectedApnKey() {
|
||||||
|
String key = null;
|
||||||
|
|
||||||
|
Cursor cursor = managedQuery(PREFERAPN_URI, new String[] {"_id"},
|
||||||
|
null, Telephony.Carriers.DEFAULT_SORT_ORDER);
|
||||||
|
if (cursor.getCount() > 0) {
|
||||||
|
cursor.moveToFirst();
|
||||||
|
key = cursor.getString(ID_INDEX);
|
||||||
|
}
|
||||||
|
cursor.close();
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean restoreDefaultApn() {
|
private boolean restoreDefaultApn() {
|
||||||
showDialog(DIALOG_RESTORE_DEFAULTAPN);
|
showDialog(DIALOG_RESTORE_DEFAULTAPN);
|
||||||
mRestoreDefaultApnMode = true;
|
mRestoreDefaultApnMode = true;
|
||||||
|
@@ -39,6 +39,7 @@ import android.net.Uri;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.text.format.Formatter;
|
import android.text.format.Formatter;
|
||||||
import android.util.Config;
|
import android.util.Config;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -60,11 +61,11 @@ import java.util.Collections;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity to pick an application that will be used to display installation information and
|
* Activity to pick an application that will be used to display installation information and
|
||||||
@@ -98,6 +99,8 @@ public class ManageApplications extends ListActivity implements
|
|||||||
|
|
||||||
// Log information boolean
|
// Log information boolean
|
||||||
private boolean localLOGV = Config.LOGV || false;
|
private boolean localLOGV = Config.LOGV || false;
|
||||||
|
private static final boolean DEBUG_SIZE = false;
|
||||||
|
private static final boolean DEBUG_TIME = false;
|
||||||
|
|
||||||
// attributes used as keys when passing values to InstalledAppDetails activity
|
// attributes used as keys when passing values to InstalledAppDetails activity
|
||||||
public static final String APP_PKG_PREFIX = "com.android.settings.";
|
public static final String APP_PKG_PREFIX = "com.android.settings.";
|
||||||
@@ -142,6 +145,8 @@ public class ManageApplications extends ListActivity implements
|
|||||||
private static final int REFRESH_APP_RESOURCE = HANDLER_MESSAGE_BASE+7;
|
private static final int REFRESH_APP_RESOURCE = HANDLER_MESSAGE_BASE+7;
|
||||||
private static final int REFRESH_DONE = HANDLER_MESSAGE_BASE+8;
|
private static final int REFRESH_DONE = HANDLER_MESSAGE_BASE+8;
|
||||||
private static final int NEXT_LOAD_STEP = HANDLER_MESSAGE_BASE+9;
|
private static final int NEXT_LOAD_STEP = HANDLER_MESSAGE_BASE+9;
|
||||||
|
private static final int COMPUTE_END = HANDLER_MESSAGE_BASE+10;
|
||||||
|
|
||||||
|
|
||||||
// observer object used for computing pkg sizes
|
// observer object used for computing pkg sizes
|
||||||
private PkgSizeObserver mObserver;
|
private PkgSizeObserver mObserver;
|
||||||
@@ -161,9 +166,6 @@ public class ManageApplications extends ListActivity implements
|
|||||||
private static final int DLG_BASE = 0;
|
private static final int DLG_BASE = 0;
|
||||||
private static final int DLG_LOADING = DLG_BASE + 1;
|
private static final int DLG_LOADING = DLG_BASE + 1;
|
||||||
|
|
||||||
// compute index used to track the application size computations
|
|
||||||
private int mComputeIndex;
|
|
||||||
|
|
||||||
// Size resource used for packages whose size computation failed for some reason
|
// Size resource used for packages whose size computation failed for some reason
|
||||||
private CharSequence mInvalidSizeStr;
|
private CharSequence mInvalidSizeStr;
|
||||||
private CharSequence mComputingSizeStr;
|
private CharSequence mComputingSizeStr;
|
||||||
@@ -186,6 +188,7 @@ public class ManageApplications extends ListActivity implements
|
|||||||
|
|
||||||
// Thread to load resources
|
// Thread to load resources
|
||||||
ResourceLoaderThread mResourceThread;
|
ResourceLoaderThread mResourceThread;
|
||||||
|
private TaskRunner mSizeComputor;
|
||||||
|
|
||||||
String mCurrentPkgName;
|
String mCurrentPkgName;
|
||||||
|
|
||||||
@@ -204,6 +207,7 @@ public class ManageApplications extends ListActivity implements
|
|||||||
// initiate the first computation and loading of resources
|
// initiate the first computation and loading of resources
|
||||||
private boolean mJustCreated = true;
|
private boolean mJustCreated = true;
|
||||||
private boolean mFirst = false;
|
private boolean mFirst = false;
|
||||||
|
private long mLoadTimeStart;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handler class to handle messages for various operations
|
* Handler class to handle messages for various operations
|
||||||
@@ -250,9 +254,9 @@ public class ManageApplications extends ListActivity implements
|
|||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
case INIT_PKG_INFO:
|
case INIT_PKG_INFO:
|
||||||
if(localLOGV) Log.i(TAG, "Message INIT_PKG_INFO");
|
if(localLOGV) Log.i(TAG, "Message INIT_PKG_INFO");
|
||||||
List<ApplicationInfo> newList = getInstalledApps(FILTER_APPS_ALL);
|
|
||||||
if (!mJustCreated) {
|
if (!mJustCreated) {
|
||||||
// Add or delete newly created packages by comparing lists
|
// Add or delete newly created packages by comparing lists
|
||||||
|
List<ApplicationInfo> newList = getInstalledApps(FILTER_APPS_ALL);
|
||||||
updateAppList(newList);
|
updateAppList(newList);
|
||||||
}
|
}
|
||||||
// Retrieve the package list and init some structures
|
// Retrieve the package list and init some structures
|
||||||
@@ -269,26 +273,13 @@ public class ManageApplications extends ListActivity implements
|
|||||||
if(ps == null) {
|
if(ps == null) {
|
||||||
Log.i(TAG, "Invalid package stats for package:"+pkgName);
|
Log.i(TAG, "Invalid package stats for package:"+pkgName);
|
||||||
} else {
|
} else {
|
||||||
int pkgId = mAppInfoAdapter.getIndex(pkgName);
|
|
||||||
if(mComputeIndex != pkgId) {
|
|
||||||
//spurious call from stale observer
|
|
||||||
Log.w(TAG, "Stale call back from PkgSizeObserver");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
mAppInfoAdapter.updateAppSize(pkgName, ps);
|
mAppInfoAdapter.updateAppSize(pkgName, ps);
|
||||||
}
|
}
|
||||||
mComputeIndex++;
|
break;
|
||||||
if (mComputeIndex < mAppInfoAdapter.getCount()) {
|
case COMPUTE_END :
|
||||||
// initiate compute package size for next pkg in list
|
|
||||||
mObserver.invokeGetSizeInfo(mAppInfoAdapter.getApplicationInfo(
|
|
||||||
mComputeIndex),
|
|
||||||
COMPUTE_PKG_SIZE_DONE);
|
|
||||||
} else {
|
|
||||||
// End computation here
|
|
||||||
mComputeSizes = true;
|
mComputeSizes = true;
|
||||||
mFirst = true;
|
mFirst = true;
|
||||||
mHandler.sendEmptyMessage(NEXT_LOAD_STEP);
|
mHandler.sendEmptyMessage(NEXT_LOAD_STEP);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case REMOVE_PKG:
|
case REMOVE_PKG:
|
||||||
if(localLOGV) Log.i(TAG, "Message REMOVE_PKG");
|
if(localLOGV) Log.i(TAG, "Message REMOVE_PKG");
|
||||||
@@ -364,7 +355,7 @@ public class ManageApplications extends ListActivity implements
|
|||||||
case REFRESH_APP_RESOURCE:
|
case REFRESH_APP_RESOURCE:
|
||||||
AppInfo aInfo = (AppInfo) msg.obj;
|
AppInfo aInfo = (AppInfo) msg.obj;
|
||||||
if(aInfo == null) {
|
if(aInfo == null) {
|
||||||
Log.w(TAG, "Error loading icons for applications");
|
Log.w(TAG, "Error loading resources");
|
||||||
} else {
|
} else {
|
||||||
mAppInfoAdapter.updateAppsResourceInfo(aInfo);
|
mAppInfoAdapter.updateAppsResourceInfo(aInfo);
|
||||||
}
|
}
|
||||||
@@ -399,7 +390,7 @@ public class ManageApplications extends ListActivity implements
|
|||||||
// Create list view from the adapter here. Wait till the sort order
|
// Create list view from the adapter here. Wait till the sort order
|
||||||
// of list is defined. its either by label or by size. so atleast one of the
|
// of list is defined. its either by label or by size. so atleast one of the
|
||||||
// first steps should be complete before filling the list
|
// first steps should be complete before filling the list
|
||||||
mAppInfoAdapter.sortList(mSortOrder);
|
mAppInfoAdapter.sortBaseList(mSortOrder);
|
||||||
if (mJustCreated) {
|
if (mJustCreated) {
|
||||||
// Set the adapter here.
|
// Set the adapter here.
|
||||||
mJustCreated = false;
|
mJustCreated = false;
|
||||||
@@ -419,6 +410,87 @@ public class ManageApplications extends ListActivity implements
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SizeObserver extends IPackageStatsObserver.Stub {
|
||||||
|
private int mMsgId;
|
||||||
|
private CountDownLatch mCount;
|
||||||
|
|
||||||
|
SizeObserver(int msgId) {
|
||||||
|
mMsgId = msgId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void invokeGetSize(String packageName, CountDownLatch count) {
|
||||||
|
mCount = count;
|
||||||
|
mPm.getPackageSizeInfo(packageName, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onGetStatsCompleted(PackageStats pStats, boolean pSucceeded) {
|
||||||
|
AppInfo appInfo = null;
|
||||||
|
Bundle data = new Bundle();
|
||||||
|
data.putString(ATTR_PKG_NAME, pStats.packageName);
|
||||||
|
if(pSucceeded && pStats != null) {
|
||||||
|
if (localLOGV) Log.i(TAG, "onGetStatsCompleted::"+pStats.packageName+", ("+
|
||||||
|
pStats.cacheSize+","+
|
||||||
|
pStats.codeSize+", "+pStats.dataSize);
|
||||||
|
data.putParcelable(ATTR_APP_PKG_STATS, pStats);
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "Invalid package stats from PackageManager");
|
||||||
|
}
|
||||||
|
//post message to Handler
|
||||||
|
Message msg = mHandler.obtainMessage(mMsgId, data);
|
||||||
|
msg.setData(data);
|
||||||
|
mHandler.sendMessage(msg);
|
||||||
|
mCount.countDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TaskRunner extends Thread {
|
||||||
|
private List<ApplicationInfo> mPkgList;
|
||||||
|
private SizeObserver mSizeObserver;
|
||||||
|
private static final int END_MSG = COMPUTE_END;
|
||||||
|
private static final int mMsgId = COMPUTE_PKG_SIZE_DONE;
|
||||||
|
volatile boolean abort = false;
|
||||||
|
|
||||||
|
TaskRunner(List<ApplicationInfo> appList) {
|
||||||
|
mPkgList = appList;
|
||||||
|
mSizeObserver = new SizeObserver(mMsgId);
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAbort() {
|
||||||
|
abort = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
long startTime;
|
||||||
|
if (DEBUG_SIZE || DEBUG_TIME) {
|
||||||
|
startTime = SystemClock.elapsedRealtime();
|
||||||
|
}
|
||||||
|
int size = mPkgList.size();
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
if (abort) {
|
||||||
|
// Exit if abort has been set.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
CountDownLatch count = new CountDownLatch(1);
|
||||||
|
String packageName = mPkgList.get(i).packageName;
|
||||||
|
long startPkgTime;
|
||||||
|
if (DEBUG_SIZE) {
|
||||||
|
startPkgTime = SystemClock.elapsedRealtime();
|
||||||
|
}
|
||||||
|
mSizeObserver.invokeGetSize(packageName, count);
|
||||||
|
try {
|
||||||
|
count.await();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Log.i(TAG, "Failed computing size for pkg : "+packageName);
|
||||||
|
}
|
||||||
|
if (DEBUG_SIZE) Log.i(TAG, "Took "+(SystemClock.elapsedRealtime() - startPkgTime) +
|
||||||
|
" ms to compute size for pkg : "+packageName);
|
||||||
|
}
|
||||||
|
if (DEBUG_SIZE || DEBUG_TIME) Log.i(TAG, "Took "+ (SystemClock.elapsedRealtime() - startTime)+ " ms to compute resources " );
|
||||||
|
mHandler.sendEmptyMessage(END_MSG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This method compares the current cache against a new list of
|
* This method compares the current cache against a new list of
|
||||||
* installed applications and tries to update the list with add or remove
|
* installed applications and tries to update the list with add or remove
|
||||||
@@ -587,7 +659,6 @@ public class ManageApplications extends ListActivity implements
|
|||||||
// some initialization code used when kicking off the size computation
|
// some initialization code used when kicking off the size computation
|
||||||
private void initAppList(List<ApplicationInfo> appList, int filterOption) {
|
private void initAppList(List<ApplicationInfo> appList, int filterOption) {
|
||||||
setProgressBarIndeterminateVisibility(true);
|
setProgressBarIndeterminateVisibility(true);
|
||||||
mComputeIndex = 0;
|
|
||||||
mComputeSizes = false;
|
mComputeSizes = false;
|
||||||
mLoadLabels = false;
|
mLoadLabels = false;
|
||||||
// Initialize lists
|
// Initialize lists
|
||||||
@@ -597,20 +668,25 @@ public class ManageApplications extends ListActivity implements
|
|||||||
|
|
||||||
// Utility method to start a thread to read application labels and icons
|
// Utility method to start a thread to read application labels and icons
|
||||||
private void initResourceThread() {
|
private void initResourceThread() {
|
||||||
//load resources now
|
if ((mResourceThread != null) && mResourceThread.isAlive()) {
|
||||||
if(mResourceThread.isAlive()) {
|
mResourceThread.setAbort();
|
||||||
mResourceThread.interrupt();
|
}
|
||||||
mResourceThread = new ResourceLoaderThread();
|
mResourceThread = new ResourceLoaderThread();
|
||||||
|
List<ApplicationInfo> appList = mAppInfoAdapter.getBaseAppList();
|
||||||
|
if ((appList != null) && (appList.size()) > 0) {
|
||||||
|
mResourceThread.loadAllResources(appList);
|
||||||
}
|
}
|
||||||
mResourceThread.loadAllResources(mAppInfoAdapter.getAppList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initComputeSizes() {
|
private void initComputeSizes() {
|
||||||
// initiate compute pkg sizes
|
// Initiate compute package sizes
|
||||||
if (localLOGV) Log.i(TAG, "Initiating compute sizes for first time");
|
if (localLOGV) Log.i(TAG, "Initiating compute sizes for first time");
|
||||||
if (mAppInfoAdapter.getCount() > 0) {
|
if ((mSizeComputor != null) && (mSizeComputor.isAlive())) {
|
||||||
mObserver.invokeGetSizeInfo(mAppInfoAdapter.getApplicationInfo(0),
|
mSizeComputor.setAbort();
|
||||||
COMPUTE_PKG_SIZE_DONE);
|
}
|
||||||
|
List<ApplicationInfo> appList = mAppInfoAdapter.getBaseAppList();
|
||||||
|
if ((appList != null) && (appList.size()) > 0) {
|
||||||
|
mSizeComputor = new TaskRunner(appList);
|
||||||
} else {
|
} else {
|
||||||
mComputeSizes = true;
|
mComputeSizes = true;
|
||||||
}
|
}
|
||||||
@@ -640,27 +716,55 @@ public class ManageApplications extends ListActivity implements
|
|||||||
|
|
||||||
class ResourceLoaderThread extends Thread {
|
class ResourceLoaderThread extends Thread {
|
||||||
List<ApplicationInfo> mAppList;
|
List<ApplicationInfo> mAppList;
|
||||||
|
volatile boolean abort = false;
|
||||||
|
|
||||||
|
public void setAbort() {
|
||||||
|
abort = true;
|
||||||
|
}
|
||||||
void loadAllResources(List<ApplicationInfo> appList) {
|
void loadAllResources(List<ApplicationInfo> appList) {
|
||||||
mAppList = appList;
|
mAppList = appList;
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
Map<String, AppInfo> iconMap = new HashMap<String, AppInfo>();
|
long start;
|
||||||
if(mAppList == null || mAppList.size() <= 0) {
|
if (DEBUG_TIME) {
|
||||||
|
start = SystemClock.elapsedRealtime();
|
||||||
|
}
|
||||||
|
int imax;
|
||||||
|
if(mAppList == null || (imax = mAppList.size()) <= 0) {
|
||||||
Log.w(TAG, "Empty or null application list");
|
Log.w(TAG, "Empty or null application list");
|
||||||
} else {
|
} else {
|
||||||
for (ApplicationInfo appInfo : mAppList) {
|
for (int i = 0; i < imax; i++) {
|
||||||
CharSequence appName = appInfo.loadLabel(mPm);
|
if (abort) {
|
||||||
Drawable appIcon = appInfo.loadIcon(mPm);
|
return;
|
||||||
Message msg = mHandler.obtainMessage(REFRESH_APP_RESOURCE);
|
|
||||||
msg.obj = new AppInfo(appInfo.packageName, appName, appIcon);
|
|
||||||
mHandler.sendMessage(msg);
|
|
||||||
}
|
}
|
||||||
|
ApplicationInfo appInfo = mAppList.get(i);
|
||||||
|
CharSequence appName = appInfo.loadLabel(mPm);
|
||||||
|
Message msg = mHandler.obtainMessage(REFRESH_APP_RESOURCE);
|
||||||
|
msg.obj = new AppInfo(appInfo.packageName, appName, null);
|
||||||
|
mHandler.sendMessage(msg);
|
||||||
}
|
}
|
||||||
Message doneMsg = mHandler.obtainMessage(REFRESH_DONE);
|
Message doneMsg = mHandler.obtainMessage(REFRESH_DONE);
|
||||||
mHandler.sendMessage(doneMsg);
|
mHandler.sendMessage(doneMsg);
|
||||||
|
if (DEBUG_TIME) Log.i(TAG, "Took "+(SystemClock.elapsedRealtime()-start)+" ms to load app labels");
|
||||||
|
long startIcons;
|
||||||
|
if (DEBUG_TIME) {
|
||||||
|
startIcons = SystemClock.elapsedRealtime();
|
||||||
|
}
|
||||||
|
for (int i = (imax-1); i >= 0; i--) {
|
||||||
|
if (abort) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ApplicationInfo appInfo = mAppList.get(i);
|
||||||
|
Drawable appIcon = appInfo.loadIcon(mPm);
|
||||||
|
Message msg = mHandler.obtainMessage(REFRESH_APP_RESOURCE);
|
||||||
|
msg.obj = new AppInfo(appInfo.packageName, null, appIcon);
|
||||||
|
mHandler.sendMessage(msg);
|
||||||
|
}
|
||||||
|
if (DEBUG_TIME) Log.i(TAG, "Took "+(SystemClock.elapsedRealtime()-startIcons)+" ms to load app icons");
|
||||||
|
}
|
||||||
|
if (DEBUG_TIME) Log.i(TAG, "Took "+(SystemClock.elapsedRealtime()-start)+" ms to load app resources");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -676,10 +780,16 @@ public class ManageApplications extends ListActivity implements
|
|||||||
public PackageStats appStats;
|
public PackageStats appStats;
|
||||||
|
|
||||||
public void refreshIcon(AppInfo pInfo) {
|
public void refreshIcon(AppInfo pInfo) {
|
||||||
|
if (pInfo == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pInfo.appName != null) {
|
||||||
appName = pInfo.appName;
|
appName = pInfo.appName;
|
||||||
|
}
|
||||||
|
if (pInfo.appIcon != null) {
|
||||||
appIcon = pInfo.appIcon;
|
appIcon = pInfo.appIcon;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public AppInfo(String pName, CharSequence aName, Drawable aIcon) {
|
public AppInfo(String pName, CharSequence aName, Drawable aIcon) {
|
||||||
index = -1;
|
index = -1;
|
||||||
pkgName = pName;
|
pkgName = pName;
|
||||||
@@ -770,12 +880,12 @@ public class ManageApplications extends ListActivity implements
|
|||||||
} else {
|
} else {
|
||||||
mAppList = appList;
|
mAppList = appList;
|
||||||
}
|
}
|
||||||
mAppLocalList = getFilteredApps(appList, filterOption);
|
|
||||||
int sortOrder = SORT_ORDER_ALPHA;
|
|
||||||
if (mAppPropCache != null) {
|
if (mAppPropCache != null) {
|
||||||
// Retain previous sort order
|
// Retain previous sort order
|
||||||
sortOrder = mSortOrder;
|
int sortOrder = mSortOrder;
|
||||||
mAppPropMap = mAppPropCache;
|
mAppPropMap = mAppPropCache;
|
||||||
|
// TODO is this required?
|
||||||
|
sortAppList(mAppList, sortOrder);
|
||||||
} else {
|
} else {
|
||||||
// Recreate property map
|
// Recreate property map
|
||||||
mAppPropMap = new TreeMap<String, AppInfo>();
|
mAppPropMap = new TreeMap<String, AppInfo>();
|
||||||
@@ -784,7 +894,7 @@ public class ManageApplications extends ListActivity implements
|
|||||||
mAlphaComparator = null;
|
mAlphaComparator = null;
|
||||||
mSizeComparator = null;
|
mSizeComparator = null;
|
||||||
|
|
||||||
sortAppList(sortOrder);
|
mAppLocalList = getFilteredApps(appList, filterOption);
|
||||||
int imax = appList.size();
|
int imax = appList.size();
|
||||||
for (int i = 0; i < imax; i++) {
|
for (int i = 0; i < imax; i++) {
|
||||||
ApplicationInfo info = appList.get(i);
|
ApplicationInfo info = appList.get(i);
|
||||||
@@ -802,7 +912,7 @@ public class ManageApplications extends ListActivity implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public AppInfoAdapter(Context c, List<ApplicationInfo> appList) {
|
public AppInfoAdapter(Context c, List<ApplicationInfo> appList) {
|
||||||
initMapFromList(appList, mFilterApps);
|
mAppList = appList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
@@ -849,8 +959,8 @@ public class ManageApplications extends ListActivity implements
|
|||||||
return mAppPropMap.get(mAppLocalList.get(position).packageName).index;
|
return mAppPropMap.get(mAppLocalList.get(position).packageName).index;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ApplicationInfo> getAppList() {
|
public List<ApplicationInfo> getBaseAppList() {
|
||||||
return mAppLocalList;
|
return mAppList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
@@ -908,13 +1018,20 @@ public class ManageApplications extends ListActivity implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sortAppList(int sortOrder) {
|
public void sortAppList(List<ApplicationInfo> appList, int sortOrder) {
|
||||||
Collections.sort(mAppLocalList, getAppComparator(sortOrder));
|
Collections.sort(appList, getAppComparator(sortOrder));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sortBaseList(int sortOrder) {
|
||||||
|
if (localLOGV) Log.i(TAG, "Sorting base list based on sortOrder = "+sortOrder);
|
||||||
|
sortAppList(mAppList, sortOrder);
|
||||||
|
mAppLocalList = getFilteredApps(mAppList, mFilterApps);
|
||||||
|
adjustIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sortList(int sortOrder) {
|
public void sortList(int sortOrder) {
|
||||||
if (localLOGV) Log.i(TAG, "sortOrder = "+sortOrder);
|
if (localLOGV) Log.i(TAG, "sortOrder = "+sortOrder);
|
||||||
sortAppList(sortOrder);
|
sortAppList(mAppLocalList, sortOrder);
|
||||||
adjustIndex();
|
adjustIndex();
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
@@ -964,39 +1081,8 @@ public class ManageApplications extends ListActivity implements
|
|||||||
return mSizeComparator;
|
return mSizeComparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* This method updates resource information in the package map.
|
|
||||||
*
|
|
||||||
* @param iconMap a map of package names and attributes
|
|
||||||
* @return A boolean value to indicate if the property map has to be
|
|
||||||
* refreshed completely
|
|
||||||
*/
|
|
||||||
public boolean updateAppsResourceInfo(Map<String, AppInfo> iconMap) {
|
|
||||||
if(iconMap == null) {
|
|
||||||
Log.w(TAG, "Null iconMap when refreshing icon in List Adapter");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
boolean changed = false;
|
|
||||||
for (ApplicationInfo info : mAppList) {
|
|
||||||
AppInfo pInfo = iconMap.get(info.packageName);
|
|
||||||
if(pInfo != null) {
|
|
||||||
AppInfo aInfo = mAppPropMap.get(info.packageName);
|
|
||||||
if (aInfo != null) {
|
|
||||||
aInfo.refreshIcon(pInfo);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(changed) {
|
|
||||||
notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean updateAppsResourceInfo(AppInfo pInfo) {
|
public boolean updateAppsResourceInfo(AppInfo pInfo) {
|
||||||
if(pInfo == null) {
|
if((pInfo == null) || (pInfo.pkgName == null)) {
|
||||||
Log.w(TAG, "Null info when refreshing icon in List Adapter");
|
Log.w(TAG, "Null info when refreshing icon in List Adapter");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1192,6 +1278,10 @@ public class ManageApplications extends ListActivity implements
|
|||||||
mHandler.removeMessages(REORDER_LIST);
|
mHandler.removeMessages(REORDER_LIST);
|
||||||
mHandler.removeMessages(ADD_PKG_START);
|
mHandler.removeMessages(ADD_PKG_START);
|
||||||
mHandler.removeMessages(ADD_PKG_DONE);
|
mHandler.removeMessages(ADD_PKG_DONE);
|
||||||
|
mHandler.removeMessages(REFRESH_APP_RESOURCE);
|
||||||
|
mHandler.removeMessages(REFRESH_DONE);
|
||||||
|
mHandler.removeMessages(NEXT_LOAD_STEP);
|
||||||
|
mHandler.removeMessages(COMPUTE_END);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessageToHandler(int msgId, int arg1) {
|
private void sendMessageToHandler(int msgId, int arg1) {
|
||||||
@@ -1295,8 +1385,8 @@ public class ManageApplications extends ListActivity implements
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
Intent lIntent = getIntent();
|
Intent intent = getIntent();
|
||||||
String action = lIntent.getAction();
|
String action = intent.getAction();
|
||||||
if (action.equals(Intent.ACTION_MANAGE_PACKAGE_STORAGE)) {
|
if (action.equals(Intent.ACTION_MANAGE_PACKAGE_STORAGE)) {
|
||||||
mSortOrder = SORT_ORDER_SIZE;
|
mSortOrder = SORT_ORDER_SIZE;
|
||||||
mSizesFirst = true;
|
mSizesFirst = true;
|
||||||
@@ -1343,6 +1433,9 @@ public class ManageApplications extends ListActivity implements
|
|||||||
|
|
||||||
|
|
||||||
private void showLoadingMsg() {
|
private void showLoadingMsg() {
|
||||||
|
if (DEBUG_TIME) {
|
||||||
|
mLoadTimeStart = SystemClock.elapsedRealtime();
|
||||||
|
}
|
||||||
showDialog(DLG_LOADING);
|
showDialog(DLG_LOADING);
|
||||||
if(localLOGV) Log.i(TAG, "Displaying Loading message");
|
if(localLOGV) Log.i(TAG, "Displaying Loading message");
|
||||||
}
|
}
|
||||||
@@ -1350,13 +1443,13 @@ public class ManageApplications extends ListActivity implements
|
|||||||
private void dismissLoadingMsg() {
|
private void dismissLoadingMsg() {
|
||||||
if(localLOGV) Log.i(TAG, "Dismissing Loading message");
|
if(localLOGV) Log.i(TAG, "Dismissing Loading message");
|
||||||
dismissDialog(DLG_LOADING);
|
dismissDialog(DLG_LOADING);
|
||||||
|
if (DEBUG_TIME) Log.i(TAG, "Displayed loading message for "+
|
||||||
|
(SystemClock.elapsedRealtime() - mLoadTimeStart));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
// Create a thread to load resources
|
|
||||||
mResourceThread = new ResourceLoaderThread();
|
|
||||||
// register receiver
|
// register receiver
|
||||||
mReceiver.registerReceiver();
|
mReceiver.registerReceiver();
|
||||||
sendMessageToHandler(INIT_PKG_INFO);
|
sendMessageToHandler(INIT_PKG_INFO);
|
||||||
@@ -1365,6 +1458,9 @@ public class ManageApplications extends ListActivity implements
|
|||||||
@Override
|
@Override
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
|
// Stop the background threads
|
||||||
|
mResourceThread.setAbort();
|
||||||
|
mSizeComputor.setAbort();
|
||||||
// clear all messages related to application list
|
// clear all messages related to application list
|
||||||
clearMessagesInHandler();
|
clearMessagesInHandler();
|
||||||
// register receiver here
|
// register receiver here
|
||||||
|
@@ -162,6 +162,13 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
|
|||||||
mVibrate.setChecked(vibrateSetting);
|
mVibrate.setChecked(vibrateSetting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int silentModeStreams = Settings.System.getInt(getContentResolver(),
|
||||||
|
Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0);
|
||||||
|
boolean isAlarmInclSilentMode = (silentModeStreams & (1 << AudioManager.STREAM_ALARM)) != 0;
|
||||||
|
mSilent.setSummary(isAlarmInclSilentMode ?
|
||||||
|
R.string.silent_mode_incl_alarm_summary :
|
||||||
|
R.string.silent_mode_summary);
|
||||||
|
|
||||||
boolean animations = true;
|
boolean animations = true;
|
||||||
try {
|
try {
|
||||||
mAnimationScales = mWindowManager.getAnimationScales();
|
mAnimationScales = mWindowManager.getAnimationScales();
|
||||||
|
@@ -126,36 +126,7 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
|
|||||||
private void queueCommand(BluetoothJob job) {
|
private void queueCommand(BluetoothJob job) {
|
||||||
Log.d(TAG, workQueue.toString());
|
Log.d(TAG, workQueue.toString());
|
||||||
synchronized (workQueue) {
|
synchronized (workQueue) {
|
||||||
boolean processNow = false;
|
boolean processNow = pruneQueue(job);
|
||||||
long now = System.currentTimeMillis();
|
|
||||||
|
|
||||||
Iterator<BluetoothJob> it = workQueue.iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
BluetoothJob existingJob = it.next();
|
|
||||||
|
|
||||||
// Remove any pending CONNECTS when we receive a DISCONNECT
|
|
||||||
if (job.command == BluetoothCommand.DISCONNECT) {
|
|
||||||
if (existingJob.timeSent == 0
|
|
||||||
&& existingJob.command == BluetoothCommand.CONNECT
|
|
||||||
&& existingJob.device.mAddress.equals(job.device.mAddress)
|
|
||||||
&& existingJob.profile == job.profile) {
|
|
||||||
it.remove();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Defensive Code: Remove any job that older than a preset time.
|
|
||||||
// We never got a call back. It is better to have overlapping
|
|
||||||
// calls than to get stuck.
|
|
||||||
Log.d(TAG, "Age:" + (now - existingJob.timeSent));
|
|
||||||
if (existingJob.timeSent != 0
|
|
||||||
&& (now - existingJob.timeSent) >= MAX_WAIT_TIME_FOR_FRAMEWORK) {
|
|
||||||
Log.w(TAG, "Timeout. Removing Job:" + existingJob.toString());
|
|
||||||
it.remove();
|
|
||||||
processNow = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add job to queue
|
// Add job to queue
|
||||||
Log.d(TAG, "Adding: " + job.toString());
|
Log.d(TAG, "Adding: " + job.toString());
|
||||||
@@ -172,6 +143,40 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean pruneQueue(BluetoothJob job) {
|
||||||
|
boolean removedStaleItems = false;
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
Iterator<BluetoothJob> it = workQueue.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
BluetoothJob existingJob = it.next();
|
||||||
|
|
||||||
|
// Remove any pending CONNECTS when we receive a DISCONNECT
|
||||||
|
if (job != null && job.command == BluetoothCommand.DISCONNECT) {
|
||||||
|
if (existingJob.timeSent == 0
|
||||||
|
&& existingJob.command == BluetoothCommand.CONNECT
|
||||||
|
&& existingJob.device.mAddress.equals(job.device.mAddress)
|
||||||
|
&& existingJob.profile == job.profile) {
|
||||||
|
Log.d(TAG, "Removed because of a pending disconnect. " + existingJob);
|
||||||
|
it.remove();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Defensive Code: Remove any job that older than a preset time.
|
||||||
|
// We never got a call back. It is better to have overlapping
|
||||||
|
// calls than to get stuck.
|
||||||
|
Log.d(TAG, "Age:" + (now - existingJob.timeSent));
|
||||||
|
if (existingJob.timeSent != 0
|
||||||
|
&& (now - existingJob.timeSent) >= MAX_WAIT_TIME_FOR_FRAMEWORK) {
|
||||||
|
Log.w(TAG, "Timeout. Removing Job:" + existingJob.toString());
|
||||||
|
it.remove();
|
||||||
|
removedStaleItems = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return removedStaleItems;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean processCommand(BluetoothJob job) {
|
private boolean processCommand(BluetoothJob job) {
|
||||||
boolean successful = false;
|
boolean successful = false;
|
||||||
if (job.timeSent == 0) {
|
if (job.timeSent == 0) {
|
||||||
@@ -199,15 +204,29 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onProfileStateChanged() {
|
public void onProfileStateChanged() {
|
||||||
// Remove the first item and process the next one
|
Log.d(TAG, "onProfileStateChanged:" + workQueue.toString());
|
||||||
BluetoothJob job = workQueue.poll();
|
BluetoothJob job = workQueue.peek();
|
||||||
if (job == null) {
|
if (job == null) {
|
||||||
Log.w(TAG, "Yikes, onProfileStateChanged called but job queue is empty");
|
Log.v(TAG, "Yikes, onProfileStateChanged called but job queue is empty. "
|
||||||
|
+ "(Okay for device initiated actions and BluetoothA2dpService initiated "
|
||||||
|
+ "Auto-connections)");
|
||||||
|
return;
|
||||||
} else if (job.device.mAddress != mAddress) {
|
} else if (job.device.mAddress != mAddress) {
|
||||||
Log.w(TAG, "Yikes, onProfileStateChanged called but the address differ. this.mAddress="
|
// This can happen in 2 cases: 1) BT device initiated pairing and
|
||||||
|
// 2) disconnects of one headset that's triggered by connects of
|
||||||
|
// another.
|
||||||
|
Log.v(TAG, "onProfileStateChanged called. The addresses differ. this.mAddress="
|
||||||
+ mAddress + " workQueue.head=" + job.toString());
|
+ mAddress + " workQueue.head=" + job.toString());
|
||||||
|
|
||||||
|
// Check to see if we need to remove the stale items from the queue
|
||||||
|
if (!pruneQueue(null)) {
|
||||||
|
// nothing in the queue was modify. Just ignore the notification and return.
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Remove the first item and process the next one
|
||||||
Log.d(TAG, "LocalBluetoothDevice.onProfileStateChanged() called. MAC addr matched");
|
Log.d(TAG, "LocalBluetoothDevice.onProfileStateChanged() called. MAC addr matched");
|
||||||
|
workQueue.poll();
|
||||||
}
|
}
|
||||||
|
|
||||||
processCommands();
|
processCommands();
|
||||||
@@ -221,6 +240,7 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
|
|||||||
* notification when it finishes processing a command
|
* notification when it finishes processing a command
|
||||||
*/
|
*/
|
||||||
private void processCommands() {
|
private void processCommands() {
|
||||||
|
Log.d(TAG, "processCommands:" + workQueue.toString());
|
||||||
Iterator<BluetoothJob> it = workQueue.iterator();
|
Iterator<BluetoothJob> it = workQueue.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
BluetoothJob job = it.next();
|
BluetoothJob job = it.next();
|
||||||
|
@@ -178,6 +178,7 @@ public class Status extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mPhone = PhoneFactory.getDefaultPhone();
|
mPhone = PhoneFactory.getDefaultPhone();
|
||||||
|
// Note - missing in zaku build, be careful later...
|
||||||
mSignalStrength = findPreference("signal_strength");
|
mSignalStrength = findPreference("signal_strength");
|
||||||
mUptime = findPreference("up_time");
|
mUptime = findPreference("up_time");
|
||||||
mAwakeTime = findPreference("awake_time");
|
mAwakeTime = findPreference("awake_time");
|
||||||
@@ -241,9 +242,11 @@ public class Status extends PreferenceActivity {
|
|||||||
if (TextUtils.isEmpty(text)) {
|
if (TextUtils.isEmpty(text)) {
|
||||||
text = sUnknown;
|
text = sUnknown;
|
||||||
}
|
}
|
||||||
|
// some preferences may be missing
|
||||||
|
if (findPreference(preference) != null) {
|
||||||
findPreference(preference).setSummary(text);
|
findPreference(preference).setSummary(text);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateNetworkType() {
|
private void updateNetworkType() {
|
||||||
// Whether EDGE, UMTS, etc...
|
// Whether EDGE, UMTS, etc...
|
||||||
@@ -300,6 +303,8 @@ public class Status extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void updateSignalStrength() {
|
void updateSignalStrength() {
|
||||||
|
// not loaded in some versions of the code (e.g., zaku)
|
||||||
|
if (mSignalStrength != null) {
|
||||||
int state =
|
int state =
|
||||||
mPhoneStateReceiver.getServiceState().getState();
|
mPhoneStateReceiver.getServiceState().getState();
|
||||||
Resources r = getResources();
|
Resources r = getResources();
|
||||||
@@ -322,6 +327,7 @@ public class Status extends PreferenceActivity {
|
|||||||
+ String.valueOf(signalAsu) + " "
|
+ String.valueOf(signalAsu) + " "
|
||||||
+ r.getString(R.string.radioInfo_display_asu));
|
+ r.getString(R.string.radioInfo_display_asu));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setWifiStatus() {
|
private void setWifiStatus() {
|
||||||
WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
|
WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
|
||||||
|
Reference in New Issue
Block a user