2017-02-09 93 views
1

正如你所知道的Android開發者:修復片段注入漏洞

起2017年3月1日,谷歌Play不會阻止任何新的應用程序或更新的發佈,這些PreferenceActivity類可能會受到片段注射

在頁面https://support.google.com/faqs/answer/7188427它提供了一些建議,如何解決這個漏洞但是用Xamarin開發的應用程序呢?

我還沒有找到關於此的任何信息。它說,我受影響的類是SettingActivity,從PreferenceActivity繼承和我的課SettingActivity是這樣的:

[Activity(
    Label = "@string/ApplicationName", 
    Icon = "@drawable/ic_launcher", 
    Theme = "@android:style/Theme.Holo.Light", 
    ParentActivity = typeof(MainActivity))] 
[IntentFilter(
    new [] {Intent.ActionManageNetworkUsage}, 
    Categories= new [] {Intent.CategoryDefault} 
)] 
public class SettingsActivity : PreferenceActivity 
{ 
    public static readonly string KeyWifiOnly = "pref_wifi_only"; 

    protected override void OnCreate(Bundle savedInstanceState) 
    { 
     base.OnCreate(savedInstanceState); 
     AddPreferencesFromResource(Resource.Xml.preferences); 

     ActionBar.SetHomeButtonEnabled(true); 
     ActionBar.SetDisplayHomeAsUpEnabled(true); 

     PreferenceManager.SetDefaultValues(this, Resource.Xml.preferences, false); 

     SetupNetworkPreferences(); 
    } 

    private void SetupNetworkPreferences() 
    { 
     var prefs = PreferenceManager.GetDefaultSharedPreferences(this); 

     ListPreference list = FindPreference(
      AppSettings.PreferenceNetworkProvider) as ListPreference; 

     list.SetEntries(
      Enum.GetNames(typeof(AppSettings.FtpHostNetwork))); 

     list.SetEntryValues(Enum 
      .GetValues(typeof(AppSettings.FtpHostNetwork)) 
      .Cast<int>() 
      .Select(x => x.ToString()) 
      .ToArray()); 
    } 

    protected override void OnResume() 
    { 
     base.OnResume(); 

     var tracker = (Application as App).Tracker; 
     tracker.Screen("PantallaPreferencias"); 
    } 
} 
+1

儘量設置導出到假'【活動( 標籤= 「@字符串/應用程序名稱」,遠銷=假, 圖標= 「@繪製/ ic_launcher」, 主題=「@android:風格/主題。 Holo.Light」, ParentActivity = typeof運算(MainActivity))] [IntentFilter的( 新的[] {} Intent.ActionManageNetworkUsage, 分類=新[] {} Intent.CategoryDe​​fault )]' –

+0

是的,這做的伎倆。非常感謝邁克。你剛剛救了我的工作 – GalloPinto

回答

0

正如意見建議由Mike馬:

添加遠銷=假propierty工作就好了。

[Activity(Label = "@string/ApplicationName", Exported =false, Icon = "@drawable/ic_launcher", Theme = "@android:style/Theme.Holo.Light", ParentActivity = typeof(MainActivity))]