Allow system apps to add to settings dashboard
Allow system apps to add a tile to the top level of settings that links to an activity through adding a filter for a specific action. Determine the info for the tile based off manifest info for the activity. Also allow the same for managed profiles, but show a dialog in between to select which profile. The category in which the item is to be placed must be in meta-data. The icon and title can be specified through meta-data as well or if unspecified the activity's label and icon will be used. Also added an optional <external-tiles> tag to the dashboard category xml, this allows Settings to put external tiles in the middle of some categories (Personal does this). Bug: 19443117 Change-Id: Idc9938d1549d181103a3030a8784b527215a8399
This commit is contained in:
@@ -21,6 +21,7 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@@ -32,6 +33,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
|
||||
@@ -148,7 +150,15 @@ public class DashboardSummary extends Fragment {
|
||||
private void updateTileView(Context context, Resources res, DashboardTile tile,
|
||||
ImageView tileIcon, TextView tileTextView, TextView statusTextView) {
|
||||
|
||||
if (tile.iconRes > 0) {
|
||||
if (!TextUtils.isEmpty(tile.iconPkg)) {
|
||||
try {
|
||||
tileIcon.setImageDrawable(context.getPackageManager()
|
||||
.getResourcesForApplication(tile.iconPkg).getDrawable(tile.iconRes, null));
|
||||
} catch (NameNotFoundException | Resources.NotFoundException e) {
|
||||
tileIcon.setImageDrawable(null);
|
||||
tileIcon.setBackground(null);
|
||||
}
|
||||
} else if (tile.iconRes > 0) {
|
||||
tileIcon.setImageResource(tile.iconRes);
|
||||
} else {
|
||||
tileIcon.setImageDrawable(null);
|
||||
|
Reference in New Issue
Block a user