Merge "Fix battery tip app name is empty"
This commit is contained in:
committed by
Android (Google) Code Review
commit
61858369d2
@@ -749,7 +749,7 @@ public final class Utils extends com.android.settingslib.Utils {
|
|||||||
| PackageManager.MATCH_ANY_USER);
|
| PackageManager.MATCH_ANY_USER);
|
||||||
return appInfo.loadLabel(context.getPackageManager());
|
return appInfo.loadLabel(context.getPackageManager());
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
Log.w(TAG, "Unable to find info for package: " + packageName);
|
Log.e(TAG, "Unable to find info for package: " + packageName);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
import com.android.settingslib.utils.StringUtil;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -78,7 +77,12 @@ public class HighUsageAdapter extends RecyclerView.Adapter<HighUsageAdapter.View
|
|||||||
holder.appIcon.setImageDrawable(
|
holder.appIcon.setImageDrawable(
|
||||||
Utils.getBadgedIcon(mIconDrawableFactory, mPackageManager, app.packageName,
|
Utils.getBadgedIcon(mIconDrawableFactory, mPackageManager, app.packageName,
|
||||||
UserHandle.getUserId(app.uid)));
|
UserHandle.getUserId(app.uid)));
|
||||||
holder.appName.setText(Utils.getApplicationLabel(mContext, app.packageName));
|
CharSequence label = Utils.getApplicationLabel(mContext, app.packageName);
|
||||||
|
if (label == null) {
|
||||||
|
label = app.packageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
holder.appName.setText(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user