make expanded notif off by default; handle exceptions better
- some devices seem to not like these new expanded/remoteviews notifications, so we are turning them off by default. This will also help with load issues on onionoo servers
This commit is contained in:
parent
11d3f59543
commit
0d424797a2
|
@ -55,20 +55,7 @@
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textAppearance="@style/NotificationTitle"
|
android:textAppearance="@style/NotificationTitle"
|
||||||
/>
|
/>
|
||||||
<ViewStub android:id="@+id/time"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="0"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout="@layout/notification_template_part_time"
|
|
||||||
/>
|
|
||||||
<ViewStub android:id="@+id/chronometer"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="0"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout="@layout/notification_template_part_chronometer"
|
|
||||||
/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/line3"
|
android:id="@+id/line3"
|
||||||
|
@ -131,13 +118,5 @@
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:fadingEdge="horizontal"
|
android:fadingEdge="horizontal"
|
||||||
/>
|
/>
|
||||||
<ProgressBar
|
|
||||||
android:id="@android:id/progress"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="12dp"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
style="?android:attr/progressBarStyleHorizontal"
|
|
||||||
/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
|
@ -227,9 +227,15 @@
|
||||||
<string name="unable_to_start_tor">Unable to start Tor:</string>
|
<string name="unable_to_start_tor">Unable to start Tor:</string>
|
||||||
<string name="pref_use_sys_iptables_title">Use Default Iptables</string>
|
<string name="pref_use_sys_iptables_title">Use Default Iptables</string>
|
||||||
<string name="pref_use_sys_iptables_summary">use the built-in iptables binary instead of the one bundled with Orbot</string>
|
<string name="pref_use_sys_iptables_summary">use the built-in iptables binary instead of the one bundled with Orbot</string>
|
||||||
|
|
||||||
<string name="error_installing_binares">The Tor binaries were not able to be installed or upgraded.</string>
|
<string name="error_installing_binares">The Tor binaries were not able to be installed or upgraded.</string>
|
||||||
|
|
||||||
<string name="pref_use_persistent_notifications">Always keep the icon in toolbar when Orbot is connected</string>
|
<string name="pref_use_persistent_notifications">Always keep the icon in toolbar when Orbot is connected</string>
|
||||||
<string name="pref_use_persistent_notifications_title">Always-On Notifications</string>
|
<string name="pref_use_persistent_notifications_title">Always-On Notifications</string>
|
||||||
|
|
||||||
|
<string name="pref_use_expanded_notifications">Show expanded notification with Tor exit country and IP</string>
|
||||||
|
<string name="pref_use_expanded_notifications_title">Expanded Notifications</string>
|
||||||
|
|
||||||
<string name="notification_using_bridges">Bridges enabled!</string>
|
<string name="notification_using_bridges">Bridges enabled!</string>
|
||||||
<string name="default_bridges"/>
|
<string name="default_bridges"/>
|
||||||
<string name="set_locale_title">Set Locale</string>
|
<string name="set_locale_title">Set Locale</string>
|
||||||
|
|
|
@ -23,6 +23,13 @@ android:summary="@string/pref_use_persistent_notifications"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:title="@string/pref_use_persistent_notifications_title"/>
|
android:title="@string/pref_use_persistent_notifications_title"/>
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="pref_expanded_notifications"
|
||||||
|
android:summary="@string/pref_use_expanded_notifications"
|
||||||
|
android:enabled="true"
|
||||||
|
android:title="@string/pref_use_expanded_notifications_title"/>
|
||||||
|
|
||||||
|
|
||||||
<ListPreference android:title="@string/set_locale_title"
|
<ListPreference android:title="@string/set_locale_title"
|
||||||
android:key="pref_default_locale"
|
android:key="pref_default_locale"
|
||||||
|
|
|
@ -128,6 +128,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
private NotificationManager mNotificationManager = null;
|
private NotificationManager mNotificationManager = null;
|
||||||
private Builder mNotifyBuilder;
|
private Builder mNotifyBuilder;
|
||||||
private Notification mNotification;
|
private Notification mNotification;
|
||||||
|
private boolean mShowExpandedNotifications = false;
|
||||||
|
|
||||||
private boolean mHasRoot = false;
|
private boolean mHasRoot = false;
|
||||||
private boolean mEnableTransparentProxy = false;
|
private boolean mEnableTransparentProxy = false;
|
||||||
|
@ -270,7 +271,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
|
|
||||||
mNotification = mNotifyBuilder.build();
|
mNotification = mNotifyBuilder.build();
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= 16) {
|
if (Build.VERSION.SDK_INT >= 16 && mShowExpandedNotifications) {
|
||||||
|
|
||||||
|
|
||||||
// Create remote view that needs to be set as bigContentView for the notification.
|
// Create remote view that needs to be set as bigContentView for the notification.
|
||||||
|
@ -317,8 +318,6 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
|
|
||||||
expandedView.setTextViewText(R.id.title, getString(R.string.app_name));
|
expandedView.setTextViewText(R.id.title, getString(R.string.app_name));
|
||||||
|
|
||||||
// expandedView.setTextViewText(R.id.info, infoMessage.toString());
|
|
||||||
// expandedView.setOnClickPendingIntent(R.id._tor_notificationBT, pendIntent);
|
|
||||||
expandedView.setImageViewResource(R.id.icon, icon);
|
expandedView.setImageViewResource(R.id.icon, icon);
|
||||||
mNotification.bigContentView = expandedView;
|
mNotification.bigContentView = expandedView;
|
||||||
}
|
}
|
||||||
|
@ -723,6 +722,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
mEnableTransparentProxy = prefs.getBoolean("pref_transparent", false);
|
mEnableTransparentProxy = prefs.getBoolean("pref_transparent", false);
|
||||||
mTransProxyAll = prefs.getBoolean("pref_transparent_all", false);
|
mTransProxyAll = prefs.getBoolean("pref_transparent_all", false);
|
||||||
mTransProxyTethering = prefs.getBoolean("pref_transparent_tethering", false);
|
mTransProxyTethering = prefs.getBoolean("pref_transparent_tethering", false);
|
||||||
|
mShowExpandedNotifications = prefs.getBoolean("pref_expanded_notifications", false);
|
||||||
|
|
||||||
ENABLE_DEBUG_LOG = prefs.getBoolean("pref_enable_logging",false);
|
ENABLE_DEBUG_LOG = prefs.getBoolean("pref_enable_logging",false);
|
||||||
Log.i(TAG,"debug logging:" + ENABLE_DEBUG_LOG);
|
Log.i(TAG,"debug logging:" + ENABLE_DEBUG_LOG);
|
||||||
|
@ -766,7 +766,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
*
|
*
|
||||||
* the idea is that if Tor is off then transproxy is off
|
* the idea is that if Tor is off then transproxy is off
|
||||||
*/
|
*/
|
||||||
protected boolean enableTransparentProxy (boolean proxyAll, boolean enableTether) throws Exception
|
private boolean enableTransparentProxy (boolean proxyAll, boolean enableTether) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
if (mTransProxy == null)
|
if (mTransProxy == null)
|
||||||
|
@ -1124,7 +1124,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
{
|
{
|
||||||
logNotice("unable to get control port; file not found");
|
logNotice("unable to get control port; file not found");
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
logNotice("unable to read control port config file");
|
logNotice("unable to read control port config file");
|
||||||
}
|
}
|
||||||
|
@ -1170,7 +1170,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
public void addEventHandler () throws IOException
|
public void addEventHandler () throws Exception
|
||||||
{
|
{
|
||||||
// We extend NullEventHandler so that we don't need to provide empty
|
// We extend NullEventHandler so that we don't need to provide empty
|
||||||
// implementations for all the events we don't care about.
|
// implementations for all the events we don't care about.
|
||||||
|
@ -1386,6 +1386,8 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
|
|
||||||
logNotice(sb.toString());
|
logNotice(sb.toString());
|
||||||
|
|
||||||
|
if (mShowExpandedNotifications)
|
||||||
|
{
|
||||||
//get IP from last nodename
|
//get IP from last nodename
|
||||||
if(status.equals("BUILT")){
|
if(status.equals("BUILT")){
|
||||||
|
|
||||||
|
@ -1410,7 +1412,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1585,9 +1587,9 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(IOException ioe)
|
catch(Exception ioe)
|
||||||
{
|
{
|
||||||
Log.e(TAG,"Unable to get Tor information",ioe);
|
// Log.e(TAG,"Unable to get Tor information",ioe);
|
||||||
logNotice("Unable to get Tor information"+ioe.getMessage());
|
logNotice("Unable to get Tor information"+ioe.getMessage());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -1621,7 +1623,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ioe)
|
catch (Exception ioe)
|
||||||
{
|
{
|
||||||
|
|
||||||
logException("Unable to get Tor configuration: " + ioe.getMessage(),ioe);
|
logException("Unable to get Tor configuration: " + ioe.getMessage(),ioe);
|
||||||
|
@ -1678,7 +1680,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
//checkAddressAndCountry();
|
//checkAddressAndCountry();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException ioe){
|
catch (Exception ioe){
|
||||||
debug("error requesting newnym: " + ioe.getLocalizedMessage());
|
debug("error requesting newnym: " + ioe.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1855,7 +1857,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private boolean processSettingsImpl () throws RemoteException, IOException
|
private boolean processSettingsImpl () throws Exception
|
||||||
{
|
{
|
||||||
logNotice(getString(R.string.updating_settings_in_tor_service));
|
logNotice(getString(R.string.updating_settings_in_tor_service));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue