[Settings] Set different ringtones at work profile

Updated the Settings app to allow setting different default system
ringtones for work profile apps

Bug: 30658854
Change-Id: I7461be070bd4e8d86bf1fd724039e53d500094ad
This commit is contained in:
Andre Lago
2016-07-25 14:12:28 +01:00
parent 78589d8e41
commit 3e398c87f2
5 changed files with 358 additions and 7 deletions

View File

@@ -1160,4 +1160,17 @@ public final class Utils extends com.android.settingslib.Utils {
}
return false;
}
/**
* Returns a context created from the given context for the given user, or null if it fails
*/
public static Context createPackageContextAsUser(Context context, int userId) {
try {
return context.createPackageContextAsUser(
context.getPackageName(), 0 /* flags */, UserHandle.of(userId));
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Failed to create user context", e);
}
return null;
}
}