[ROOT] Hide/show system bar (rooted) - Nexus 10 Android Development

I got issue with Nexus 10 - 4.2.2. I was testing this on Galaxy Tab 10.1 with 4.0.4 and it was working fine:
try
{
Process proc = Runtime.getRuntime().exec(new String[]{"sh","startservice","-n","com.android.systemui/.SystemUIService"});
proc.waitFor();
}
catch (Exception e)
{
e.printStackTrace();
}
try
{
//REQUIRES ROOT
Process proc = Runtime.getRuntime().exec(new String[]{"su","-c","service call activity 42 s16 com.android.systemui"}); //WAS 79
proc.waitFor();
}
catch(Exception ex)
{
//Toast.makeText(getApplicationContext(), ex.getMessage(), Toast.LENGTH_LONG).show();
}
Hide and show system bar and keys, but on Nexus 10 just hide and than System UI Service got stack on restarting. Anyone know why?

I found the solution, but don't know how to remove the post :/
Solution:
To show and hide the system bar and notification bar on 4.2.2 and others:
Hide:
try
{
String command;
command = "LD_LIBRARY_PATH=/vendor/lib:/system/lib service call activity 42 s16 com.android.systemui";
Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", command }, envp);
proc.waitFor();
}
catch(Exception ex)
{
Toast.makeText(getApplicationContext(), ex.getMessage(), Toast.LENGTH_LONG).show();
}
Show:
try
{
String command;
command = "LD_LIBRARY_PATH=/vendor/lib:/system/lib am startservice -n com.android.systemui/.SystemUIService";
Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", command }, envp);
proc.waitFor();
}
catch (Exception e)
{
e.printStackTrace();
}

Related

[Q] Developing app that requires root - freezes after asking for su

I am new to android development and am having an issue. I am working on an app that requires root and when I request it using this code:
Code:
Runtime.getRuntime().exec(new String[] {"su"});
I get the request, Allow it then the app locks up and doesn't go to the next item. I am trying to figure out the debugging environment in eclipse, but have not figured out a way to debug this. Is there something I need to do after acquiring root? The next line of code is a simple Toast, so I know it is locking up at the su command. Is there any documentation on writing root apps anybody can point me to? Or is there a simple answer? Thanks in advance.
EDIT: Just in case the whole code will help, here it is:
Code:
public class toggle extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
String[] results = executeShellCommand(new String[] {"su"});
Toast toast = Toast.makeText(this, results[0], Toast.LENGTH_SHORT);
toast.show();
finish();
}
public String[] executeShellCommand(String[] args) {
Process mLogcatProc = null;
BufferedReader reader = null;
BufferedReader errorReader = null;
String logResult = null;
String errorLogResult = null;
String separator = System.getProperty("line.separator");
try
{
mLogcatProc = Runtime.getRuntime().exec(args);
reader = new BufferedReader(new InputStreamReader(mLogcatProc.getInputStream()));
errorReader = new BufferedReader(new InputStreamReader(mLogcatProc.getErrorStream()));
String line;
final StringBuilder log = new StringBuilder();
while ((line = reader.readLine()) != null)
{
log.append(line);
log.append(separator);
}
logResult = log.toString();
String errorLine;
final StringBuilder errorLog = new StringBuilder();
while ((errorLine = errorReader.readLine()) != null)
{
errorLog.append(errorLine);
errorLog.append(separator);
}
errorLogResult = errorLog.toString();
if((logResult.length() == 0) || (errorLogResult.length() > 0))
{
if(errorLogResult.length() > 0)
{
return errorLogResult.split(separator);
}
else
{
return (new String[] {"null_result"});
}
}
else
{
return logResult.split(separator);
}
}
catch (Exception e)
{
return (new String[] {e.toString()});
}
finally
{
if (reader != null)
try
{
reader.close();
}
catch (IOException e)
{
}
}
}
}
I do this a bunch in my RogueTools app.
Take a peek here:
https://github.com/myn/RogueTools/blob/master/src/com/logicvoid/roguetools/OverClock.java
Let me know if you need a hand.
myn said:
I do this a bunch in my RogueTools app.
Take a peek here:
https://github.com/myn/RogueTools/blob/master/src/com/logicvoid/roguetools/OverClock.java
Let me know if you need a hand.
Click to expand...
Click to collapse
Thanks a ton, I should be able to get it from here....I'll let you know if not.
Myn always on top of things
Sent from my unrEVOked using xda app

How Apps/SWF can call Apps

I was wondering, how Apps can call/start other Apps...
For instance internal Apps...
Also how we can modify for instance samsungApps.swf
Maybe we could create funny Theme with "App Starter"...
Best Regards
Code:
//Action tag #0
function dTrace(str)
{
++dtraceN;
this.dbg.text = this.dbg.text + ("\n" + dtraceN + " : " + str);
if (this.dbg.maxscroll > 1)
{
this.dbg.text = "";
}
}
function languageChange()
{
AppsClass.startSamsungApps();
}
function fontChange()
{
AppsClass.startSamsungApps();
}
function mouseEvent(type, mX, mY)
{
var __reg3 = undefined;
__reg3 = Gadget.SamsungApps.mouseClick(type, mX, mY);
if (type == "up" && __reg3 != true)
{
_root.dTrace("launch]Widget," + this);
}
}
function hasSound(type, mX, mY)
{
var __reg1 = undefined;
__reg1 = Gadget.SamsungApps.clickSound(type, mX, mY);
return __reg1;
}
function sendEvent(eventName, eventObj)
{
this.ExtendedEvents[eventName].addListener(eventObj);
listenerObj[eventName] = eventObj;
}
function removeEvent()
{
for (var __reg2 in listenerObj)
{
this.ExtendedEvents[__reg2].removeListener(listenerObj[__reg2]);
}
}
var dtraceN = 0;
this.ExtendedEvents = ExtendedEvents;
var AppsClass = Gadget.SamsungApps.getSamsungApps(this);
AppsClass.startSamsungApps();
this.widgetType = "launch";
this.launch = true;
var listenerObj = new Object();
This we can extract with Flash Decompiler...
Best Regards

Need Developer Help - Form Refreshing

Hello,
i started to wrote my first WO7 applicatin.
I got following code:
Code:
private void BtnStart_Click(object sender, RoutedEventArgs e)
{
BtnStart.Content = "Calculating...";
for (int i = 0; i < Pb1.Maximum; i++)
{
...
}
...
}
My Problem is that the content of the Button doesn't change to "Calculating". Even my Progressbar:
Code:
private void PbStep()
{
if (Pb1.Value == Pb1.Maximum)
{
Pb1.Value = 0;
MessageBox.Show("Progressbar Overflow");
}
else
{
Pb1.Value = Pb1.Value + 1;
}
}
It is wrapped in s loop, and the bar begins with 0 and then switsch to 100%, but i cant see the steps between.
I think i need a refresh command. in visual basic it is Me.Update();.
I tried many codes from google, but nothing helped. I hope some1 can help me.
many thank
Try
Code:
Dispatcher.BeginInvoke(() =>
{
BtnStart.Content = "Calculating...";
});
i did already try this. but now when i press the button, while calculation nothing happens, and after the calculation is finished, the button content changes to "calculating" and don't changes back to "start".
so i put the code in both parts and now i got the same as before. the button did not change its content
Code:
private void BtnStart_Click(object sender, RoutedEventArgs e)
{
LblDuration.Text = "";
Dispatcher.BeginInvoke(() =>
{
BtnStart.Content = "Calculating...";
});
Pb1.Value = 0.0;
Pb1.Maximum = Max;
DateTime StartZeit = DateTime.Now;
for (int i = 0; i < Pb1.Maximum; i++)
{
PbStep();//Count Up PorgressBar
}
DateTime EndZeit = DateTime.Now;
TimeSpan GemesseneZeit = EndZeit - StartZeit;
LblDuration.Text = "Duration: " + GemesseneZeit.ToString();
Dispatcher.BeginInvoke(() =>
{
BtnStart.Content = "Start";
});
}
private void PbStep()
{
try
{
Pb1.Value = Pb1.Value + 1;
}
catch
{
Pb1.Value = 0;
MessageBox.Show("Progressbar Overflow");
}
}
But thank you for your help. any other ideas?
you really need to be looking at a background thread (background worker control may allow you do do this)
any tight loop like that will freeze the UI until the loop has finished
in the 'old days' a doevents within the loop itself would have been suffice but this is not good practice
HTH
Try this one, it does what you've trying to implement but using a correct way:
Code:
using System.Windows.Threading;
private void BtnStart_Click(object sender, RoutedEventArgs e)
{
BtnStart.Content = "Calculating...";
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromMilliseconds(100);
timer.Tick += (_, __) =>
{
// Here is replacement of your PbStep()
Pb1.Value++;
};
timer.Start();
}
i got it now this way:
Code:
private void BtnStart_Click(object sender, RoutedEventArgs e)
{
LblDuration.Text = "Duration: Calculating...";
BtnStart.Content = "Wait";
DateTime StartZeit = DateTime.Now;
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromMilliseconds(1);
timer.Tick += (_, __) =>
{
for (int i = 0; i < Pb1.Maximum; i++)
{
Pb1.Value++;
}
timer.Stop();
LblDuration.Text = "Duration: " + (DateTime.Now - StartZeit).ToString();
BtnStart.Content = "Start";
};
timer.Start();
}
It is half working. When i press Start, the button changes its content imediatly and after finishing the loop it return to its default content.
now i got 2 problems:
1. the progressbar isnt smooth jet
and the bigger one:
2. i wanted to create a benchmark programm an measure how long it takes to count a progressbar from 0 to 1million. now with the timer i dont have the real cpu speed because it is always waiting for the timer to tick. so the benchmark is sensless
@ cameronm:
I know the DoEvent command from other languages, but i wans able to use this in c#. i mainly programm in visual basic, cause this seems to be easy (In this case i would use Me.Update). I have heard from the Background worker, but never tried it. Maybe this can help.
I will do some google search and try to use the Background worker. I'll post again if i got new code
Thanks you all !
hello again
im now that far:
Code:
public partial class MainPage : PhoneApplicationPage
{
//Globale Variablen
private BackgroundWorker bw = new BackgroundWorker();
public int Max = 0;
// Konstruktor
public MainPage()
{
InitializeComponent();
Max = 500000;
bw.WorkerReportsProgress = true;
bw.WorkerSupportsCancellation = true;
bw.DoWork += new DoWorkEventHandler(bw_DoWork);
bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);
bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
}
private void BtnStart_Click(object sender, RoutedEventArgs e)
{
if (bw.IsBusy != true)
{
LblDuration.Text = "";
BtnStart.Content = "Calculating...";
Pb1.Value = 0.0;
Pb1.Maximum = Max;
bw.RunWorkerAsync();
}
}
private void BtnStop_Click(object sender, System.Windows.RoutedEventArgs e)
{
if (bw.WorkerSupportsCancellation == true)
{
bw.CancelAsync();
}
}
private void bw_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = sender as BackgroundWorker;
DateTime StartZeit = DateTime.Now;
//Failure by any deklarion
//like int i = 0 or BtnStart.Content = "Calculating...";
for (int i = 0; i < Pb1.Maximum; i++)
{
if ((worker.CancellationPending == true)) //Abbruchbedingung
{
e.Cancel = true;
break;
}
else //Progressbedingung
{
PbStep();//Count Up PorgressBar
}
}
DateTime EndZeit = DateTime.Now;
TimeSpan GemesseneZeit = EndZeit - StartZeit;
LblDuration.Text = "Duration: " + GemesseneZeit.ToString();
BtnStart.Content = "Start";
}
private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
if ((e.Cancelled == true))
{
this.LblStatus.Text = "Canceled!";
}
else if (!(e.Error == null))
{
this.LblStatus.Text = ("Error: " + e.Error.Message);
}
else
{
this.LblStatus.Text = "Done!";
}
}
private void bw_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
this.LblPercentage.Text = (e.ProgressPercentage.ToString() + "%");
}
private void PbStep()
{
try
{
Pb1.Value = Pb1.Value + 1;
}
catch
{
Pb1.Value = 0;
MessageBox.Show("Progressbar Overflow");
}
}
In the DoWork Function i receive an error when i try to set a variable like int i=0.
The Failure:UnauthorizedAccessException: Invalid cross-thread access
i followed this instruction: http://msdn.microsoft.com/en-us/library/cc221403(v=vs.95).aspx
but there they did the same. why did i have the error?
win98 said:
The Failure:UnauthorizedAccessException: Invalid cross-thread access
why did i have the error?
Click to expand...
Click to collapse
The exception you've got show exactly what's wrong: you are trying to access GUI thread variables from another (BackgroundWorker) thread.
Use Dispatcher.Invoke as I recommended to you a few posts above.
thank you sensboston. id dont understand why, because i just have one bgworker, but now it works
Code:
private void BtnStart_Click(object sender, RoutedEventArgs e)
{
if (bw.IsBusy != true)
{
LblDuration.Text = "";
BtnStart.Content = "Calculating...";
Pb1.Value = 0.0;
Pb1.Maximum = Max;
bw.RunWorkerAsync();
}
}
private void bw_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = sender as BackgroundWorker;
DateTime StartZeit = DateTime.Now;
Dispatcher.BeginInvoke(() =>
{
LblDuration.Text = "";
BtnStart.Content = "Calculating...";
for (int i = 0; i < Pb1.Maximum; i++)
{
if ((worker.CancellationPending == true)) //Abbruchbedingung
{
e.Cancel = true;
break;
}
else //Progressbedingung
{
Pb1.Value = Pb1.Value + 1;
//PbStep();
}
}
DateTime EndZeit = DateTime.Now;
TimeSpan GemesseneZeit = EndZeit - StartZeit;
LblDuration.Text = "Duration: " + GemesseneZeit.ToString();
BtnStart.Content = "Start";
});
}
private void bw_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
this.LblPercentage.Text = (e.ProgressPercentage.ToString() + "%");
}
Just my progressbar isnt running fluently. still just 0% (before calc) or 100% (after calc) and no steps between
win98 said:
Just my progressbar isnt running fluently. still just 0% (before calc) or 100% (after calc) and no steps between
Click to expand...
Click to collapse
It's simple, dear Watson: your code updating progress bar too fast, without delays needed for GUI updates
sensboston said:
It's simple, dear Watson: your code updating progress bar too fast, without delays needed for GUI updates
Click to expand...
Click to collapse
yep agree with this .. what you are actually doing in the loop is not enough for you to acutally see the progressbar update .. fast little things these phones of ours
yeah, this was the first i tryed, before posting in this forum.
delay() did not work in c#.
Application.DoEvents() should work if i can believe google, but visual studio says there is no definition for doevents().
So i used
Code:
Pb1.Value++;
System.Threading.Thread.Sleep(1);
after each progressbar.value++, but this either didnt work...
what is the secret?
win98 said:
yeah, this was the first i tryed, before posting in this forum.
delay() did not work in c#.
Application.DoEvents() should work if i can believe google, but visual studio says there is no definition for doevents().
So i used
Code:
Pb1.Value++;
System.Threading.Thread.Sleep(1);
after each progressbar.value++, but this either didnt work...
what is the secret?
Click to expand...
Click to collapse
1 millisecond will not be enough to slow it down either
Maybe try 1000 instead ..
something else i thought of too ..
you may want to think about your design
If a progress bar is going to just flash up and complete as what you are doing is too fast .. you need to think 'is a progress bar the right control to use'
if you are going to increase the amount of work your background thread is going to do then I would say keep the progress bar
If the background thread is going to be this quick always .. then maybe a label saying 'please wait' ... and then hide the label when done .. or something similar
i tried with 1000 ms but this progress bar isnt running.
@cameronm: i want to create a "benchmark app" where the cpu counts the progressbar to 1million and measures the time. the time measuring is working correctly. i just want to get a nice GUI with a running bar, like it runs when you download and install apps from the market.
i was very long googling and found commands like progressbar.PerfomStep(); like described here http://www.java2s.com/Code/CSharp/GUI-Windows-Form/ProgressBarinC.htm
this is also c#, but i cant perfom this command. did i miss some assembly, headers or so? or is it because im doint a windows phone form and that there are less command than in a normal windows application?
You want to make a Benchmark app and you actually used :System.Threading.Thread.Sleep(*int)...!
This is not Benchmarking.
Background Worker like any other ThreadTypeClass should report it's progress via the BackgroundWorker_ProgressChanged_Event(..args).
Inside the Event either u PerformStep() either you implement your own code logic.
If even after this the worker fills instanly like "cameronm" said above then consider making the backgroundworker's Job a bit heavier or leave the progressBar and even the seperated background thread Idea cause it is not Needed.
yes, i am not luck with using a sleep command
PerformStep() is not accepted by the compiler
so you mean just counting up is to "easy". what progress could be "heavier". now i understand what cameronm meant^^
in the evening i will try more difficult calculations like sqare and multiplication of integers. would that be heavy enough?
Typing from LG quantum
Try this: make your calculations in a for loop 1-100..at each loop make progressbar.value++ .
You should be calling ReportProgress and then updating the Progress Bar in the Progress Changed function.
See: http://msdn.microsoft.com/en-us/library/cc221403(v=vs.95).aspx
@PG2G
the link you posted was exactly the source where i learned to implement the bw_worker. but with the command you told me i got an failure in the marked line (see source code comment). It says: InvalidOperationException: Operation has already been completed.
Code:
private void bw_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = sender as BackgroundWorker;
double a, b, c;
DateTime StartZeit = DateTime.Now;
Dispatcher.BeginInvoke(() =>
{
LblDuration.Text = "";
BtnStart.Content = "Calculating...";
for (int i = 0; i < Pb1.Maximum/100; i++)
{
if ((worker.CancellationPending == true))
{
e.Cancel = true;
break;
}
else
{
for (int m = 0; m < 10; m++)
{
a = 3547.23; //double
b = 2354.15; //double
c = (a * b) * (a * a * b);
}
Pb1.Value++;//PbStep();
worker.ReportProgress((i * 10)); //Failure here//
}
}
DateTime EndZeit = DateTime.Now;
TimeSpan GemesseneZeit = EndZeit - StartZeit;
LblDuration.Text = "Duration: " + GemesseneZeit.ToString();
BtnStart.Content = "Start";
});
}
@Freeboss
i tried it with your loop and a double calculation but it didnt work...
im going crazy, in vb i can do this in 10 minutes^^

Need help for a simple text app

I was wondering, if someone can guide to create a simple app which simplly displays some text on the middle of the screen and 2 buttons (Left and right arrow) to switch to the next or previous text.
I think someone just helped another user who was looking for help for something similar like me but I cannot find it.
Thanks
You can try out this sample code, starting from an empty silverlight project:
In the MainPage.xaml, add the following snippet inside the Grid element named "ContentPanel".
<TextBlock Name="tblkDisplay" Width="360" Height="100" VerticalAlignment="Top" Margin="0,200,0,0" TextAlignment="Center"></TextBlock>
<Button Name="btnBack" Width="160" Height="80" VerticalAlignment="Top" Margin="-200,308,0,0" Click="btnBack_Click">Back</Button>
<Button Name="btnForward" Width="160" Height="80" VerticalAlignment="Top" Margin="200,308,0,0" Click="btnForward_Click">Forward</Button>
This markup adds a TextBlock, and Forward and Back buttons to the page.
In the in the code-behind (MainPage.xaml.cs), use the following code:
Code:
private int _displayIndex; //position in list of text items to display
private List<string> _textItems; //List of text items to display
// Constructor
public MainPage()
{
InitializeComponent();
}
//Code that get called when the page is navigated to
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
_textItems = new List<string>();
//Add ten items to text list to display
for (int i = 0; i < 10; i++)
{
_textItems.Add("Item" + i.ToString());
}
//For the default, set to first position and display it
_displayIndex = 0;
tblkDisplay.Text = _textItems[_displayIndex];
}
//If not at the first position of the list decrement by one, otherwise move to end of the list
private void Back()
{
if (_displayIndex > 0)
{
_displayIndex--;
}
else
{
_displayIndex = _textItems.Count - 1;
}
}
//If not at the last position of the list increment by one, otherwise move to start of the list
private void Forward()
{
if (_displayIndex < _textItems.Count - 1)
{
_displayIndex++;
}
else
{
_displayIndex = 0;
}
}
private void ShowText()
{
if ((_textItems.Count > 0) //Make sure there are items in the collection to display
&& (_displayIndex < _textItems.Count) // Make sure the index is not higher than how many items in the collection
&& (_displayIndex >= 0)) //Make sure the index is zero or greater
{
tblkDisplay.Text = _textItems[_displayIndex];
}
else
{
tblkDisplay.Text = "No Items.";
}
}
private void btnBack_Click(object sender, RoutedEventArgs e)
{
Back();
ShowText();
}
private void btnForward_Click(object sender, RoutedEventArgs e)
{
Forward();
ShowText();
}

[Q] E/NotificationService : An error occurred profiling the notification.

Hi,
i'm constantly getting this error in my logcat. I've no idea what i can do to fix it. I'm using v.0.35 of Elk759's http://forum.xda-developers.com/showthread.php?t=1827934 CM10 Rom for htc desire. This error occurs since version 0.33.
Can you tell me to which app this notification service belongs? pid 456 belongs to "system_server", pid 539 belongs to "com.android.systemui" so i just can't delete the corresponding data.
Code:
D/SizeAdaptiveLayout( 539): [email protected] view [email protected] measured out of bounds at 95px clamped to 96px
E/NotificationService( 456): An error occurred profiling the notification.
E/NotificationService( 456): java.lang.NullPointerException
E/NotificationService( 456): at com.android.server.NotificationManagerService.enqueueNotificationInternal(NotificationManagerService.java:1147)
E/NotificationService( 456): at com.android.server.NotificationManagerService.enqueueNotificationWithTag(NotificationManagerService.java:983)
E/NotificationService( 456): at android.app.INotificationManager$Stub.onTransact(INotificationManager.java:129)
E/NotificationService( 456): at android.os.Binder.execTransact(Binder.java:367)
E/NotificationService( 456): at dalvik.system.NativeStart.run(Native Method)
D/SizeAdaptiveLayout( 539): [email protected] view [email protected] measured out of bounds at 95px clamped to 96px
E/NotificationService( 456): An error occurred profiling the notification.
E/NotificationService( 456): java.lang.NullPointerException
E/NotificationService( 456): at com.android.server.NotificationManagerService.enqueueNotificationInternal(NotificationManagerService.java:1147)
E/NotificationService( 456): at com.android.server.NotificationManagerService.enqueueNotificationWithTag(NotificationManagerService.java:983)
E/NotificationService( 456): at android.app.INotificationManager$Stub.onTransact(INotificationManager.java:129)
E/NotificationService( 456): at android.os.Binder.execTransact(Binder.java:367)
E/NotificationService( 456): at dalvik.system.NativeStart.run(Native Method)
D/SizeAdaptiveLayout( 539): [email protected] view [email protected] measured out of bounds at 95px clamped to 96px
I found the matching code in http://code.metager.de/source/xref/CyanogenMod/AndroidFrameworksBase/services/java/com/android/server/NotificationManagerService.java. It says:
Code:
synchronized (mNotificationList) {
final boolean inQuietHours = inQuietHours();
NotificationRecord r = new NotificationRecord(pkg, tag, id,
callingUid, callingPid,
priority,
notification);
NotificationRecord old = null;
int index = indexOfNotificationLocked(pkg, tag, id);
if (index < 0) {
mNotificationList.add(r);
} else {
old = mNotificationList.remove(index);
mNotificationList.add(index, r);
// Make sure we don't lose the foreground service state.
if (old != null) {
notification.flags |=
old.notification.flags&Notification.FLAG_FOREGROUND_SERVICE;
}
}
// Ensure if this is a foreground service that the proper additional
// flags are set.
if ((notification.flags&Notification.FLAG_FOREGROUND_SERVICE) != 0) {
notification.flags |= Notification.FLAG_ONGOING_EVENT
| Notification.FLAG_NO_CLEAR;
}
if (notification.icon != 0) {
StatusBarNotification n = new StatusBarNotification(pkg, id, tag,
r.uid, r.initialPid, notification);
n.priority = r.priority;
if (old != null && old.statusBarKey != null) {
r.statusBarKey = old.statusBarKey;
long identity = Binder.clearCallingIdentity();
try {
mStatusBar.updateNotification(r.statusBarKey, n);
}
finally {
Binder.restoreCallingIdentity(identity);
}
} else {
long identity = Binder.clearCallingIdentity();
try {
r.statusBarKey = mStatusBar.addNotification(n);
if ((n.notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0) {
mAttentionLight.pulse();
}
}
finally {
Binder.restoreCallingIdentity(identity);
}
}
sendAccessibilityEvent(notification, pkg);
} else {
Slog.e(TAG, "Ignoring notification with icon==0: " + notification);
if (old != null && old.statusBarKey != null) {
long identity = Binder.clearCallingIdentity();
try {
mStatusBar.removeNotification(old.statusBarKey);
}
finally {
Binder.restoreCallingIdentity(identity);
}
}
}
try {
final ProfileManager profileManager =
(ProfileManager) mContext.getSystemService(Context.PROFILE_SERVICE);
ProfileGroup group = profileManager.getActiveProfileGroup(pkg);
notification = group.processNotification(notification);
} catch(Throwable th) {
Log.e(TAG, "An error occurred profiling the notification.", th);
}
// If we're not supposed to beep, vibrate, etc. then don't.
if (((mDisabledNotifications & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) == 0)
&& (!(old != null
&& (notification.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0 ))
&& mSystemReady) {
final AudioManager audioManager = (AudioManager) mContext
.getSystemService(Context.AUDIO_SERVICE);
// sound
final boolean useDefaultSound =
(notification.defaults & Notification.DEFAULT_SOUND) != 0;
if (!(inQuietHours && mQuietHoursMute)
&& (useDefaultSound || notification.sound != null)) {
Uri uri;
if (useDefaultSound) {
uri = Settings.System.DEFAULT_NOTIFICATION_URI;
} else {
uri = notification.sound;
}
boolean looping = (notification.flags & Notification.FLAG_INSISTENT) != 0;
int audioStreamType;
if (notification.audioStreamType >= 0) {
audioStreamType = notification.audioStreamType;
} else {
audioStreamType = DEFAULT_STREAM_TYPE;
}
mSoundNotification = r;
// do not play notifications if stream volume is 0
// (typically because ringer mode is silent).
if (audioManager.getStreamVolume(audioStreamType) != 0) {
long identity = Binder.clearCallingIdentity();
try {
mSound.play(mContext, uri, looping, audioStreamType);
}
finally {
Binder.restoreCallingIdentity(identity);
}
}
}
// vibrate
final boolean useDefaultVibrate =
(notification.defaults & Notification.DEFAULT_VIBRATE) != 0;
if (!(inQuietHours && mQuietHoursStill)
&& (useDefaultVibrate || notification.vibrate != null)
&& audioManager.shouldVibrate(AudioManager.VIBRATE_TYPE_NOTIFICATION)) {
mVibrateNotification = r;
mVibrator.vibrate(useDefaultVibrate ? DEFAULT_VIBRATE_PATTERN
: notification.vibrate,
((notification.flags & Notification.FLAG_INSISTENT) != 0) ? 0: -1);
}
}
I installed a new firmware and my backup didn't work. So i thinks this counts as a "full wipe". Anyways, i think the wrong data belongs to "systemui". You can delete all stored data with Titanium backup.
I've had the same error again after a full restore via Titanium backup. This time i deleted all data from "google play services" and it helped.
EDIT: Sorry, it came back again. I'm doing now a full wipe and only restore the data i really need.

Categories

Resources