Skip to content

Commit

Permalink
Connection tracking implementation and various issue fixes 0.4.4
Browse files Browse the repository at this point in the history
Connection Tracking :
Network monitor screen performance has been improved. New schema has been introduced to handle the changes. Now user has provision to search by app name and IP address. Filtering of logs based on blocked/all is implemented. Provision to delete the logs from network monitor.
Some of the features are yet to be implemented.

Bug FIxes:

* Samsung Minor bug fix - Introduced the INTERACT_ACROSS_USERS permission for samsung devices.
Always-on -  prompt is shown now when user taps the 'Start' button.

* Background Apps - Universal firewall for allow apps on background logic is changed. Now the uid's which are in range from APP_START to APP_END is included. Now it works as originally intended.
#65

* Lwip Fix - A critical stability fix that caused frequent app crashes in the background.
#32

* Accessbility Services - On-Interuppt method was not handled properly earlier.
#75

* In Firewall screen the warning text for System apps in included.
#70

* App crashes when other VPN is in active - Application state is now properly updated so that it can handle the other VPN active scenarios.

* Right-to-Left languages - UI changes. The Home screen's 'Start' button and about page UI modifications to support rtl languages.

* Firewall crash - app crash when there is change in installed/system packages. Now the app list is refreshed based on the app changes. When a new app in installed/modified/removed the list will be refreshed with the current data.

* Auto-start - auto start of application is now been disabled. Will introduce advanced settings on later versions to enable/disable the auto start of app during phone boot updated
#41
  • Loading branch information
hussainmohd-a committed Sep 7, 2020
1 parent 9734485 commit c763dd6
Show file tree
Hide file tree
Showing 60 changed files with 2,200 additions and 1,303 deletions.
10 changes: 6 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES"/>
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" android:protectionLevel="signature"/>

<application
android:allowBackup="true"
Expand All @@ -19,6 +20,7 @@
android:theme="@style/AppTheme">
<activity
android:name=".ui.FirewallActivity"
android:launchMode="singleTask"
android:theme="@style/AppTheme" />
<activity
android:name=".ui.PermissionManagerActivity"
Expand All @@ -33,6 +35,7 @@
android:theme="@style/AppTheme"/>
<activity
android:name=".ui.QueryDetailActivity"
android:launchMode="singleTask"
android:theme="@style/AppTheme"/>

<activity android:name=".ui.WelcomeActivity"
Expand All @@ -49,11 +52,9 @@
<activity android:name=".ui.FaqWebViewActivity"
android:launchMode="singleInstance"
android:theme="@style/AppTheme"/>
<activity android:name=".sample.SampleExpandable"
android:launchMode="singleInstance"
android:theme="@style/AppTheme"/>
<activity
android:name=".ui.ConnectionTrackerActivity"
android:launchMode="singleTask"
android:theme="@style/AppTheme" />


Expand Down Expand Up @@ -112,7 +113,8 @@
<receiver
android:name=".receiver.BraveScreenStateReceiver"
android:label="@string/app_name">
<intent-filter android:priority="999">
<intent-filter android:priority="999" >
<data android:scheme="package" />
<action android:name="android.intent.action.ACTION_SCREEN_OFF" />
<action android:name="android.intent.action.ACTION_SCREEN_ON" />
<action android:name="android.intent.action.ACTION_PACKAGE_ADDED" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
package com.celzero.bravedns.adapter

import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.paging.PagedListAdapter
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import com.celzero.bravedns.R
import com.celzero.bravedns.database.ConnectionTracker
import com.celzero.bravedns.ui.ConnectionTrackerActivity
import com.celzero.bravedns.util.Protocol
import com.celzero.bravedns.util.Utilities

class ConnectionTrackerAdapter(val activity : ConnectionTrackerActivity) : PagedListAdapter<ConnectionTracker, ConnectionTrackerAdapter.ConnectionTrackerViewHolder>(DIFF_CALLBACK) {


companion object {
private val DIFF_CALLBACK = object :
DiffUtil.ItemCallback<ConnectionTracker>() {
// Concert details may have changed if reloaded from the database,
// but ID is fixed.
override fun areItemsTheSame(oldConnection: ConnectionTracker, newConnection: ConnectionTracker)
= oldConnection.id == newConnection.id

override fun areContentsTheSame(oldConnection: ConnectionTracker, newConnection: ConnectionTracker)
= oldConnection == newConnection
}
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ConnectionTrackerViewHolder {
val v: View = LayoutInflater.from(parent.context).inflate(
R.layout.connection_transaction_row,
parent, false
)
return ConnectionTrackerViewHolder(v)
}

override fun onBindViewHolder(holder: ConnectionTrackerViewHolder, position: Int) {
val connTracker: ConnectionTracker? = getItem(position)
holder.update(connTracker,position)
}



inner class ConnectionTrackerViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {

// Overall view
private var rowView: View? = null

private var parentView: LinearLayout? = null

// Contents of the condensed view
private var timeView: TextView? = null
private var flagView: TextView? = null

private var fqdnView: TextView? = null
private var ipView: TextView? = null
private var latencyTxt: TextView? = null
private var queryLayoutLL: LinearLayout? = null
private var connectionType: TextView? = null
private var appIcon: ImageView? = null
private var connectionIndicator: TextView? = null

init {
rowView = itemView
parentView = itemView.findViewById(R.id.connection_parent_layout)
timeView = itemView.findViewById(R.id.connection_response_time)
flagView = itemView.findViewById(R.id.connection_flag)
fqdnView = itemView.findViewById(R.id.connection_app_name)
ipView = itemView.findViewById(R.id.connection_ip_address)
latencyTxt = itemView.findViewById(R.id.conn_latency_txt)
connectionType = itemView.findViewById(R.id.connection_type)
queryLayoutLL = itemView.findViewById(R.id.connection_screen_ll)
appIcon = itemView.findViewById(R.id.connection_app_icon)
connectionIndicator = itemView.findViewById(R.id.connection_status_indicator)
}

fun update(connTracker: ConnectionTracker?, position: Int) {
if(connTracker != null){
var time = Utilities.convertLongToTime(connTracker.timeStamp)
timeView!!.text = time
flagView!!.text = connTracker.flag
ipView!!.text = connTracker.ipAddress
latencyTxt!!.text = connTracker.port.toString()
fqdnView!!.text = connTracker.appName
connectionType!!.text = Protocol.getProtocolName(connTracker.protocol).name
if (connTracker.isBlocked)
connectionIndicator!!.visibility = View.VISIBLE
else
connectionIndicator!!.visibility = View.INVISIBLE
if (connTracker.appName != "Unknown") {
try {
var appArray = activity.packageManager.getPackagesForUid(connTracker!!.uid)
appIcon!!.setImageDrawable(activity.packageManager.getApplicationIcon(appArray?.get(0)!!))
} catch (e: Exception) {
appIcon!!.setImageDrawable(activity.getDrawable(R.drawable.default_app_icon))
Log.e("BraveDNS", "Package Not Found - " + e.message, e)
}
}

/*parentView!!.setOnClickListener {
val bottomSheetFragment = ConnTrackerBottomSheetFragment(activity, connTracker)
val frag = activity as FragmentActivity
bottomSheetFragment.show(frag.supportFragmentManager, bottomSheetFragment.tag)
}*/
}

}

}

}


Loading

0 comments on commit c763dd6

Please sign in to comment.